mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
do not use keys() method when iterating through dictionaries
pylint-1.6.4-1.fc26.noarch reports "C0201(consider-iterating-dictionary)" when building FreeIPA, we have to fix these errors https://fedorahosted.org/freeipa/ticket/6391 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
29829cc55a
commit
71f642f751
@ -802,7 +802,7 @@ def uninstall(options, env):
|
||||
root_logger.error('Some files have not been restored, see %s' %
|
||||
paths.SYSRESTORE_INDEX)
|
||||
has_state = False
|
||||
for module in statestore.modules.keys():
|
||||
for module in statestore.modules:
|
||||
root_logger.error('Some installation state for %s has not been '
|
||||
'restored, see /var/lib/ipa/sysrestore/sysrestore.state',
|
||||
module)
|
||||
|
@ -166,7 +166,7 @@ class LocalHSM(AbstractHSM):
|
||||
def import_public_key(self, source, data):
|
||||
params = ldap2p11helper_api_params(source)
|
||||
# filter out params inappropriate for public keys
|
||||
for par in set(params.keys()).difference(public_key_api_params):
|
||||
for par in set(params).difference(public_key_api_params):
|
||||
del params[par]
|
||||
params['data'] = data
|
||||
|
||||
@ -176,7 +176,7 @@ class LocalHSM(AbstractHSM):
|
||||
def import_private_key(self, source, data, unwrapping_key):
|
||||
params = ldap2p11helper_api_params(source)
|
||||
# filter out params inappropriate for private keys
|
||||
for par in set(params.keys()).difference(private_key_api_params):
|
||||
for par in set(params).difference(private_key_api_params):
|
||||
del params[par]
|
||||
params['data'] = data
|
||||
params['unwrapping_key'] = unwrapping_key.handle
|
||||
|
@ -369,7 +369,7 @@ class LDAPEntry(collections.MutableMapping):
|
||||
|
||||
self._names[name] = name
|
||||
|
||||
for oldname in self._orig.keys():
|
||||
for oldname in list(self._orig):
|
||||
if self._names.get(oldname) == name:
|
||||
self._orig[name] = self._orig.pop(oldname)
|
||||
break
|
||||
|
@ -346,7 +346,7 @@ class StateFile(object):
|
||||
"""
|
||||
root_logger.debug("Saving StateFile to '%s'", self._path)
|
||||
|
||||
for module in list(self.modules.keys()):
|
||||
for module in list(self.modules):
|
||||
if len(self.modules[module]) == 0:
|
||||
del self.modules[module]
|
||||
|
||||
@ -359,7 +359,7 @@ class StateFile(object):
|
||||
p = SafeConfigParser()
|
||||
p.optionxform = str
|
||||
|
||||
for module in self.modules.keys():
|
||||
for module in self.modules:
|
||||
p.add_section(module)
|
||||
for (key, value) in self.modules[module].items():
|
||||
p.set(module, key, str(value))
|
||||
|
@ -340,8 +340,8 @@ def _aci_to_kw(ldap, a, test=False, pkey_only=False):
|
||||
if 'target' in a.target:
|
||||
target = a.target['target']['expression']
|
||||
found = False
|
||||
for k in _type_map.keys():
|
||||
if _type_map[k] == target:
|
||||
for k, value in _type_map.items():
|
||||
if value == target:
|
||||
kw['type'] = unicode(k)
|
||||
found = True
|
||||
break
|
||||
@ -788,8 +788,8 @@ class aci_find(crud.Search):
|
||||
results.remove(a)
|
||||
continue
|
||||
found = False
|
||||
for k in _type_map.keys():
|
||||
if _type_map[k] == target and kw['type'] == k:
|
||||
for k, value in _type_map.items():
|
||||
if value == target and kw['type'] == k:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
|
@ -114,7 +114,7 @@ def _check_interval(not_before, not_after):
|
||||
|
||||
def _set_token_type(entry_attrs, **options):
|
||||
klasses = [x.lower() for x in entry_attrs.get('objectclass', [])]
|
||||
for ttype in TOKEN_TYPES.keys():
|
||||
for ttype in TOKEN_TYPES:
|
||||
cls = 'ipatoken' + ttype
|
||||
if cls.lower() in klasses:
|
||||
entry_attrs['type'] = ttype.upper()
|
||||
|
Loading…
Reference in New Issue
Block a user