Get rid of keys() usage
for x in some_dict.keys() can be written as for x in some_dict Change-Id: If5436647a30c02d0dab7daa23b2290456c66d654
This commit is contained in:
parent
7899b04888
commit
c02b9fc2dd
@ -209,7 +209,7 @@ class Registry(object):
|
||||
raise ValueError('Only %s classes or subclasses may be '
|
||||
'unregistered.' % self._registerable_class)
|
||||
|
||||
if cls not in self._registry.keys():
|
||||
if cls not in self._registry:
|
||||
raise NotRegistered('%s is not registered' % cls)
|
||||
|
||||
del self._registry[cls]
|
||||
|
@ -55,7 +55,7 @@ def _get_enforcer():
|
||||
_ENFORCER = {}
|
||||
policy_files = getattr(settings, 'POLICY_FILES', {})
|
||||
policy_dirs = getattr(settings, 'POLICY_DIRS', {})
|
||||
for service in policy_files.keys():
|
||||
for service in policy_files:
|
||||
conf = _get_policy_conf(policy_file=policy_files[service],
|
||||
policy_dirs=policy_dirs.get(service, []))
|
||||
enforcer = policy.Enforcer(conf)
|
||||
|
@ -327,7 +327,7 @@ class UpdateDomain(workflows.Workflow):
|
||||
domain=domain_id)
|
||||
users_dict = {user.id: user.name for user in all_users}
|
||||
|
||||
for user_id in users_roles.keys():
|
||||
for user_id in users_roles:
|
||||
# Don't remove roles if the user isn't in the domain
|
||||
if user_id not in users_dict:
|
||||
users_to_modify -= 1
|
||||
|
@ -794,7 +794,7 @@ class UpdateProject(workflows.Workflow):
|
||||
domain=data['domain_id'])
|
||||
users_dict = {user.id: user.name for user in all_users}
|
||||
|
||||
for user_id in users_roles.keys():
|
||||
for user_id in users_roles:
|
||||
# Don't remove roles if the user isn't in the domain
|
||||
if user_id not in users_dict:
|
||||
users_to_modify -= 1
|
||||
|
@ -417,7 +417,7 @@ class CinderApiTests(test.APIMockTestCase):
|
||||
|
||||
ret_val = api.cinder.tenant_absolute_limits(self.request)
|
||||
|
||||
for key in expected_results.keys():
|
||||
for key in expected_results:
|
||||
self.assertEqual(expected_results[key], ret_val[key])
|
||||
|
||||
mock_limit.assert_called_once()
|
||||
|
@ -359,7 +359,7 @@ class ComputeApiTests(test.APIMockTestCase):
|
||||
|
||||
ret_val = api.nova.tenant_absolute_limits(self.request, reserved=True)
|
||||
|
||||
for key in expected_results.keys():
|
||||
for key in expected_results:
|
||||
self.assertEqual(expected_results[key], ret_val[key])
|
||||
novaclient.limits.get.assert_called_once_with(reserved=True,
|
||||
tenant_id=None)
|
||||
|
@ -127,7 +127,7 @@ class Literal(types.ConfigType):
|
||||
for value in result.values():
|
||||
self.validate(value, spec_value)
|
||||
spec_key = next(iter(spec.keys()))
|
||||
for key in result.keys():
|
||||
for key in result:
|
||||
self.validate(key, spec_key)
|
||||
if isinstance(spec, list):
|
||||
if not isinstance(result, list):
|
||||
|
Loading…
Reference in New Issue
Block a user