Fix pep8 errors
Fixes existing pep8 errors and reenables the corresponding tox rules Change-Id: I4168a90c40173e4c35c9d75030cd592ace657508
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
"""test_get_audits_result module."""
|
||||
|
||||
from audit_client.api.model.get_audits_result import AuditsResult
|
||||
import unittest
|
||||
|
||||
from audit_client.api.model.get_audits_result import AuditsResult
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test get audits result class."""
|
||||
|
||||
@@ -5,10 +5,9 @@ import threading
|
||||
import unittest
|
||||
import urllib2
|
||||
|
||||
from mock import patch
|
||||
|
||||
from audit_client.api import audit
|
||||
from audit_client.api.exceptions.audit_exception import AuditException
|
||||
from mock import patch
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
|
||||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='audit_client',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""keystone_utils token validator unittests."""
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
from keystone_utils import tokens
|
||||
import mock
|
||||
|
||||
|
||||
class MyResponse(object):
|
||||
@@ -191,7 +191,7 @@ class TokensTest(unittest.TestCase):
|
||||
tokens.get_token_user, 'a', mock.MagicMock(), 'c')
|
||||
|
||||
def test_get_token_user_invalid_keystone_version(self):
|
||||
conf = tokens.TokenConf(*(None,)*5)
|
||||
conf = tokens.TokenConf(*(None,) * 5)
|
||||
self.assertRaises(ValueError, tokens.get_token_user, 'a', conf, 'c',
|
||||
'd')
|
||||
|
||||
@@ -200,7 +200,7 @@ class TokensTest(unittest.TestCase):
|
||||
ks = mock.MagicMock()
|
||||
ks.tokens.validate.side_effect = tokens.v3_client.exceptions.NotFound()
|
||||
mock_get_keystone_client.return_value = ks
|
||||
conf = tokens.TokenConf(*('3',)*5)
|
||||
conf = tokens.TokenConf(*('3',) * 5)
|
||||
self.assertIsNone(tokens.get_token_user('a', conf, 'c', 'd'))
|
||||
|
||||
@mock.patch.object(tokens, '_get_keystone_client')
|
||||
@@ -212,7 +212,7 @@ class TokensTest(unittest.TestCase):
|
||||
ks.tokens.validate.return_value = token_info
|
||||
mock_get_keystone_client.return_value = ks
|
||||
|
||||
conf = tokens.TokenConf(*('2.0',)*5)
|
||||
conf = tokens.TokenConf(*('2.0',) * 5)
|
||||
result = tokens.get_token_user('a', conf, 'c', 'd')
|
||||
|
||||
self.assertEqual(result.token, 'a')
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"""Token utility module."""
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
from keystoneclient.v2_0 import client as v2_client
|
||||
from keystoneclient.v3 import client as v3_client
|
||||
|
||||
from orm_common.utils import dictator
|
||||
|
||||
_verify = False
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from keystoneclient import exceptions
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from keystoneclient import exceptions
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='keystone_utils',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import json
|
||||
import logging
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from orm_common.utils import utils
|
||||
from pecan import abort
|
||||
from pecan.hooks import PecanHook
|
||||
from orm_common.utils import utils
|
||||
|
||||
|
||||
class TransactionIdHook(PecanHook):
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
'''
|
||||
'''
|
||||
|
||||
from .di import Di
|
||||
from .dependency_register import DependencyRegister
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
from .resolver import DependencyResolver
|
||||
|
||||
@@ -18,8 +18,7 @@ class DependencyRegister:
|
||||
|
||||
@classmethod
|
||||
def _unwrap_func(cls, decorated_func):
|
||||
'''
|
||||
This unwraps a decorated func, returning the inner wrapped func.
|
||||
'''This unwraps a decorated func, returning the inner wrapped func.
|
||||
|
||||
This may become unnecessary with Python 3.4's inspect.unwrap().
|
||||
'''
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from .dependency_register import DependencyRegister
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
from .resolver import DependencyResolver
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
|
||||
|
||||
class Di:
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from functools import partial
|
||||
|
||||
from .errors import (
|
||||
FangError,
|
||||
ProviderAlreadyRegisteredError,
|
||||
ProviderNotFoundError)
|
||||
from .errors import (FangError, ProviderAlreadyRegisteredError,
|
||||
ProviderNotFoundError)
|
||||
|
||||
|
||||
class ResourceProviderRegister:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import imp
|
||||
import os
|
||||
|
||||
from orm_common.injector import fang
|
||||
from orm_common.utils.sanitize import sanitize_symbol_name
|
||||
|
||||
import os
|
||||
import imp
|
||||
|
||||
_di = fang.Di()
|
||||
logger = None
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ import abc
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import dictator
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
registered_checks = {}
|
||||
|
||||
@@ -21,10 +21,8 @@ import re
|
||||
import six
|
||||
|
||||
import _checks
|
||||
|
||||
from oslo_policy._i18n import _LE
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@ import logging
|
||||
from keystone_utils import tokens
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import dictator
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
||||
import qolicy
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
_ENFORCER = None
|
||||
|
||||
@@ -218,16 +218,13 @@ desired rule name.
|
||||
import logging
|
||||
import os
|
||||
|
||||
import _parser
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from oslo_policy import _checks
|
||||
from oslo_policy._i18n import _
|
||||
from oslo_policy import opts
|
||||
|
||||
import _parser
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
import six
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import json
|
||||
import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import api_error_hook
|
||||
from unittest import TestCase
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import security_headers_hook
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class MyHeaders(object):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import transaction_id_hook
|
||||
from unittest import TestCase
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.injector import injector
|
||||
from unittest import TestCase
|
||||
import os
|
||||
import logging
|
||||
from orm_common.injector.fang.resource_provider_register import ResourceProviderRegister
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import _checks
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import policy
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
|
||||
class TestException(Exception):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import json
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import api_error_utils
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class TestCrossApiUtil(TestCase):
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import time
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import cross_api_utils
|
||||
from testfixtures import log_capture
|
||||
from unittest import TestCase
|
||||
import requests
|
||||
import pecan
|
||||
import logging
|
||||
import pprint
|
||||
import time
|
||||
|
||||
|
||||
class TestCrossApiUtil(TestCase):
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import logging
|
||||
import pprint
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import utils
|
||||
from testfixtures import log_capture
|
||||
from unittest import TestCase
|
||||
import requests
|
||||
import pecan
|
||||
import logging
|
||||
import pprint
|
||||
|
||||
|
||||
class TestUtil(TestCase):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
|
||||
from orm_common.utils import utils
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import requests
|
||||
import logging
|
||||
from pecan import conf
|
||||
from audit_client.api import audit
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
from pecan import conf
|
||||
|
||||
# from orm_common.logger import get_logger
|
||||
|
||||
# logger = get_logger(__name__)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import requests
|
||||
import logging
|
||||
from pecan import conf
|
||||
from audit_client.api import audit
|
||||
import time
|
||||
import pprint
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
from audit_client.api import audit
|
||||
from pecan import conf
|
||||
|
||||
# from cms_rest.logger import get_logger
|
||||
#
|
||||
@@ -218,8 +220,7 @@ def get_resource_status(resource_id):
|
||||
|
||||
|
||||
def get_time_human():
|
||||
"""
|
||||
this function return the timestamp for output JSON
|
||||
"""this function return the timestamp for output JSON
|
||||
:return: timestamp in wanted format
|
||||
"""
|
||||
return time.strftime("%a, %b %d %Y, %X (%Z)", time.gmtime())
|
||||
|
||||
Reference in New Issue
Block a user