Stop using .keys() on dicts where not needed
Iterating over a dict results in the keys. Using the 'in' operator on a dict checks if it's a key. Change-Id: I6affbfa1a79a9e8c0b5b304078a7a8e4e792eecd
This commit is contained in:
@@ -218,7 +218,7 @@ class AuthMethod(object):
|
|||||||
setattr(self, param, kwargs.pop(param, None))
|
setattr(self, param, kwargs.pop(param, None))
|
||||||
|
|
||||||
if kwargs:
|
if kwargs:
|
||||||
msg = _("Unexpected Attributes: %s") % ", ".join(kwargs.keys())
|
msg = _("Unexpected Attributes: %s") % ", ".join(kwargs)
|
||||||
raise AttributeError(msg)
|
raise AttributeError(msg)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@@ -579,7 +579,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||||||
Returns a slash-separated string of values ordered by key name.
|
Returns a slash-separated string of values ordered by key name.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return '/'.join([kwargs[k] or '?' for k in sorted(kwargs.keys())])
|
return '/'.join([kwargs[k] or '?' for k in sorted(kwargs)])
|
||||||
|
|
||||||
def get_auth_ref_from_keyring(self, **kwargs):
|
def get_auth_ref_from_keyring(self, **kwargs):
|
||||||
"""Retrieve auth_ref from keyring.
|
"""Retrieve auth_ref from keyring.
|
||||||
|
@@ -130,7 +130,7 @@ class Session(object):
|
|||||||
if not session:
|
if not session:
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
# Use TCPKeepAliveAdapter to fix bug 1323862
|
# Use TCPKeepAliveAdapter to fix bug 1323862
|
||||||
for scheme in session.adapters.keys():
|
for scheme in session.adapters:
|
||||||
session.mount(scheme, TCPKeepAliveAdapter())
|
session.mount(scheme, TCPKeepAliveAdapter())
|
||||||
|
|
||||||
self.auth = auth
|
self.auth = auth
|
||||||
@@ -682,7 +682,7 @@ class Session(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if params_copy:
|
if params_copy:
|
||||||
raise exceptions.UnsupportedParameters(list(params_copy.keys()))
|
raise exceptions.UnsupportedParameters(list(params_copy))
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
@@ -59,8 +59,8 @@ class SimpleReadOnlyKeystoneClientTest(base.ClientTestBase):
|
|||||||
# check that region and publicURL exists. One might also
|
# check that region and publicURL exists. One might also
|
||||||
# check for adminURL and internalURL. id seems to be optional
|
# check for adminURL and internalURL. id seems to be optional
|
||||||
# and is missing in the catalog backend
|
# and is missing in the catalog backend
|
||||||
self.assertIn('publicURL', svc.keys())
|
self.assertIn('publicURL', svc)
|
||||||
self.assertIn('region', svc.keys())
|
self.assertIn('region', svc)
|
||||||
|
|
||||||
def test_admin_endpoint_list(self):
|
def test_admin_endpoint_list(self):
|
||||||
out = self.keystone('endpoint-list')
|
out = self.keystone('endpoint-list')
|
||||||
|
@@ -54,7 +54,7 @@ class MemcacheCryptPositiveTests(testtools.TestCase):
|
|||||||
len(keys['MAC']))
|
len(keys['MAC']))
|
||||||
self.assertNotEqual(keys['ENCRYPTION'],
|
self.assertNotEqual(keys['ENCRYPTION'],
|
||||||
keys['MAC'])
|
keys['MAC'])
|
||||||
self.assertIn('strategy', keys.keys())
|
self.assertIn('strategy', keys)
|
||||||
|
|
||||||
def test_key_strategy_diff(self):
|
def test_key_strategy_diff(self):
|
||||||
k1 = self._setup_keys(b'MAC')
|
k1 = self._setup_keys(b'MAC')
|
||||||
|
Reference in New Issue
Block a user