diff --git a/keystoneclient/access.py b/keystoneclient/access.py index e552c18dd..1dc86705a 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -109,8 +109,8 @@ class AccessInfo(dict): :returns: bool """ if ('serviceCatalog' in self - and self['serviceCatalog'] - and 'tenant' in self['token']): + and self['serviceCatalog'] + and 'tenant' in self['token']): return True return False diff --git a/keystoneclient/client.py b/keystoneclient/client.py index b75ae540d..8e5e2bddd 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -185,8 +185,8 @@ class HTTPClient(object): if not token: token = self.auth_token_from_user - if (not token and self.auth_ref - and not self.auth_ref.will_expire_soon(self.stale_duration)): + if (not token and self.auth_ref and not + self.auth_ref.will_expire_soon(self.stale_duration)): token = self.auth_ref.auth_token (keyring_key, auth_ref) = self.get_auth_ref_from_keyring(auth_url, diff --git a/keystoneclient/contrib/ec2/utils.py b/keystoneclient/contrib/ec2/utils.py index ca5afa7a6..c971b5908 100644 --- a/keystoneclient/contrib/ec2/utils.py +++ b/keystoneclient/contrib/ec2/utils.py @@ -63,7 +63,7 @@ class Ec2Signer(object): # the query params list, check X-Amz-Algorithm=AWS4-HMAC-SHA256 try: if (credentials['params']['X-Amz-Algorithm'] == - 'AWS4-HMAC-SHA256'): + 'AWS4-HMAC-SHA256'): return True except KeyError: pass @@ -182,7 +182,7 @@ class Ec2Signer(object): try: auth_str = headers['Authorization'] param_str = auth_str.partition( - '%s=' % param_name)[2].split(',')[0] + '%s=' % param_name)[2].split(',')[0] except KeyError: param_str = params.get('X-Amz-%s' % param_name) return param_str diff --git a/keystoneclient/service_catalog.py b/keystoneclient/service_catalog.py index c57e68ea5..2938af3d1 100644 --- a/keystoneclient/service_catalog.py +++ b/keystoneclient/service_catalog.py @@ -71,8 +71,8 @@ class ServiceCatalog(object): endpoints = service['endpoints'] for endpoint in endpoints: - if self.region_name and \ - endpoint.get('region') != self.region_name: + if (self.region_name and + endpoint.get('region') != self.region_name): continue if not filter_value or endpoint.get(attr) == filter_value: return endpoint[endpoint_type] diff --git a/tests/test_auth_token_middleware.py b/tests/test_auth_token_middleware.py index ae812931e..cd81d224f 100644 --- a/tests/test_auth_token_middleware.py +++ b/tests/test_auth_token_middleware.py @@ -325,8 +325,8 @@ TOKEN_RESPONSES[SIGNED_v3_TOKEN_SCOPED_KEY] = { } }, 'roles': [ - {'name': 'role1'}, - {'name': 'role2'} + {'name': 'role1'}, + {'name': 'role2'} ], 'catalog': {} } @@ -1222,10 +1222,10 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest): def test_config_revocation_cache_timeout(self): conf = { - 'auth_host': 'keystone.example.com', - 'auth_port': 1234, - 'auth_admin_prefix': '/testadmin', - 'revocation_cache_time': 24 + 'auth_host': 'keystone.example.com', + 'auth_port': 1234, + 'auth_admin_prefix': '/testadmin', + 'revocation_cache_time': 24 } middleware = auth_token.AuthProtocol(self.fake_app, conf) self.assertEquals(middleware.token_revocation_list_cache_timeout, @@ -1362,10 +1362,10 @@ class v3AuthTokenMiddlewareTest(AuthTokenMiddlewareTest): 'revoked_token_hash': REVOKED_v3_TOKEN_HASH } super(v3AuthTokenMiddlewareTest, self).setUp( - auth_version='v3.0', - fake_app=v3FakeApp, - fake_http=v3FakeHTTPConnection, - token_dict=token_dict) + auth_version='v3.0', + fake_app=v3FakeApp, + fake_http=v3FakeHTTPConnection, + token_dict=token_dict) def assert_valid_last_url(self, token_id): # Token ID is not part of the url in v3, so override diff --git a/tests/test_shell.py b/tests/test_shell.py index 6b9b7f6dc..f16be8574 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -99,34 +99,30 @@ class ShellTest(utils.TestCase): def test_auth_no_credentials(self): with testtools.ExpectedException( - exceptions.CommandError, - 'Expecting authentication method'): + exceptions.CommandError, 'Expecting authentication method'): self.shell('user-list') def test_auth_password_authurl_no_username(self): with testtools.ExpectedException( - exceptions.CommandError, - 'Expecting a username provided via either'): + exceptions.CommandError, + 'Expecting a username provided via either'): self.shell('--os-password=%s --os-auth-url=%s user-list' % (uuid.uuid4().hex, uuid.uuid4().hex)) def test_auth_username_password_no_authurl(self): with testtools.ExpectedException( - exceptions.CommandError, - 'Expecting an auth URL via either'): + exceptions.CommandError, 'Expecting an auth URL via either'): self.shell('--os-password=%s --os-username=%s user-list' % (uuid.uuid4().hex, uuid.uuid4().hex)) def test_token_no_endpoint(self): with testtools.ExpectedException( - exceptions.CommandError, - 'Expecting an endpoint provided'): + exceptions.CommandError, 'Expecting an endpoint provided'): self.shell('--token=%s user-list' % uuid.uuid4().hex) def test_endpoint_no_token(self): with testtools.ExpectedException( - exceptions.CommandError, - 'Expecting a token provided'): + exceptions.CommandError, 'Expecting a token provided'): self.shell('--endpoint=http://10.0.0.1:5000/v2.0/ user-list') def test_shell_args(self): diff --git a/tox.ini b/tox.ini index bb4c86113..c0860fbe1 100644 --- a/tox.ini +++ b/tox.ini @@ -27,8 +27,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}' downloadcache = ~/cache/pip [flake8] -# E125: continuation line does not distinguish itself from next logical line -# E126: continuation line over-indented for hanging indent # F401: imported but unused # F811: redefinition of unused 'client' from line 81 # F821: undefined name @@ -44,6 +42,6 @@ downloadcache = ~/cache/pip # H403: multi line docstring end on new line # H404: multi line docstring should start with a summary # H802: git commit title -ignore = E125,E126,F401,F811,F821,F841,F999,H201,H202,H302,H304,H306,H401,H402,H403,H404,H802 +ignore = F401,F811,F821,F841,F999,H201,H202,H302,H304,H306,H401,H402,H403,H404,H802 show-source = True exclude = .venv,.tox,dist,doc,*egg