diff options
| author | Martin Babinsky <mbabinsk@redhat.com> | 2016-10-11 17:35:01 +0200 |
|---|---|---|
| committer | Martin Basti <mbasti@redhat.com> | 2016-10-12 10:38:52 +0200 |
| commit | 71f642f75132fe30b40062ce5abc8558a275b9bb (patch) | |
| tree | ca5c59516d1f1d2c915bc7e0aee8695e77428e53 /ipapython | |
| parent | 29829cc55a6be697abf881ea7867ef834bb66be7 (diff) | |
| download | freeipa-71f642f75132fe30b40062ce5abc8558a275b9bb.tar.gz freeipa-71f642f75132fe30b40062ce5abc8558a275b9bb.tar.xz freeipa-71f642f75132fe30b40062ce5abc8558a275b9bb.zip | |
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>
Diffstat (limited to 'ipapython')
| -rwxr-xr-x | ipapython/dnssec/localhsm.py | 4 | ||||
| -rw-r--r-- | ipapython/ipaldap.py | 2 | ||||
| -rw-r--r-- | ipapython/sysrestore.py | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/ipapython/dnssec/localhsm.py b/ipapython/dnssec/localhsm.py index d02fc75d1..befe08aec 100755 --- a/ipapython/dnssec/localhsm.py +++ b/ipapython/dnssec/localhsm.py @@ -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 diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index c6f0aaa2e..bbaeedc94 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -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 diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py index 2a8f44826..62572683a 100644 --- a/ipapython/sysrestore.py +++ b/ipapython/sysrestore.py @@ -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)) |
