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:
Martin Babinsky
2016-10-12 10:38:52 +02:00
committed by Martin Basti
parent 29829cc55a
commit 71f642f751
6 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -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))