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