Commit 0ac7903d authored by Vincent A's avatar Vincent A

remove useless dict.iterkeys() calls

parent 79a8cd91
......@@ -51,7 +51,7 @@ class NovaModule(Module, CapRadio, CapCollection):
if Radio in objs:
self._restrict_level(split_path)
for id in self._RADIOS.iterkeys():
for id in self._RADIOS:
yield self.get_radio(id)
def iter_radios_search(self, pattern):
......
......@@ -62,7 +62,7 @@ class OuiFMModule(Module, CapRadio, CapCollection):
if Radio in objs:
self._restrict_level(split_path)
for id in self._RADIOS.iterkeys():
for id in self._RADIOS:
yield self.get_radio(id)
def iter_radios_search(self, pattern):
......
......@@ -119,7 +119,7 @@ class VirginRadioModule(Module, CapRadio, CapCollection):
if Radio in objs:
self._restrict_level(split_path)
for id in self._RADIOS.iterkeys():
for id in self._RADIOS:
yield self.get_radio(id)
def iter_radios_search(self, pattern):
......
......@@ -118,7 +118,7 @@ class MainWindow(QtMainWindow):
def reloadQueriesList(self, select_name=None):
self.ui.queriesList.currentIndexChanged.disconnect(self.queryChanged)
self.ui.queriesList.clear()
for name in self.config.get('queries', default={}).iterkeys():
for name in self.config.get('queries', default={}):
self.ui.queriesList.addItem(name)
if name == select_name:
self.ui.queriesList.setCurrentIndex(len(self.ui.queriesList)-1)
......
......@@ -78,7 +78,7 @@ class WebContentEdit(ReplApplication):
# check cases where /usr/bin/vi is a symlink to vim
if 'vim' in (os.path.basename(editor), os.path.basename(os.path.realpath(find_executable(editor) or '/')).replace('.nox', '')):
params = '-p'
os.system("%s %s %s" % (editor, params, ' '.join(['"%s"' % path.replace('"', '\\"') for path in paths.iterkeys()])))
os.system("%s %s %s" % (editor, params, ' '.join('"%s"' % path.replace('"', '\\"') for path in paths)))
for path, content in paths.iteritems():
with open(path, 'r') as f:
......
......@@ -175,7 +175,7 @@ class RepositoryModulesLoader(ModulesLoader):
self.repositories = repositories
def iter_existing_module_names(self):
for name in self.repositories.get_all_modules_info().iterkeys():
for name in self.repositories.get_all_modules_info():
yield name
def get_module_path(self, module_name):
......
......@@ -463,15 +463,15 @@ class ConsoleApplication(Application):
elif v.choices:
if v.tiny is None:
v.tiny = True
for key in v.choices.iterkeys():
for key in v.choices:
if len(key) > 5 or ' ' in key:
v.tiny = False
break
if v.tiny:
question = u'%s (%s)' % (question, '/'.join((s.upper() if s == v.default else s)
for s in v.choices.iterkeys()))
for s in v.choices.iterkeys():
for s in v.choices))
for s in v.choices:
if s == v.default:
aliases[s.upper()] = s
for key, value in v.choices.iteritems():
......
......@@ -194,7 +194,7 @@ class IFormatter(object):
obj.pop(name)
if self.MANDATORY_FIELDS:
missing_fields = set(self.MANDATORY_FIELDS) - set(obj.iterkeys())
missing_fields = set(self.MANDATORY_FIELDS) - set(obj)
if missing_fields:
raise MandatoryFieldsNotFound(missing_fields)
......
......@@ -35,7 +35,7 @@ class FormattersLoader(object):
self.formatters[name] = klass
def get_available_formatters(self):
l = set(self.formatters.iterkeys())
l = set(self.formatters)
l = l.union(self.BUILTINS)
l = sorted(l)
return l
......
......@@ -796,7 +796,7 @@ class ReplApplication(Cmd, ConsoleApplication):
level = levels[args[0]]
except KeyError:
print('Level "%s" does not exist.' % args[0], file=self.stderr)
print('Availables: %s' % ' '.join(levels.iterkeys()), file=self.stderr)
print('Availables: %s' % ' '.join(levels), file=self.stderr)
return 2
else:
logging.root.setLevel(level)
......
......@@ -52,7 +52,7 @@ def mini_jsonpath(node, path):
"""
def iterkeys(i):
return range(len(i)) if type(i) is list else i.iterkeys()
return range(len(i)) if type(i) is list else i
def cut(s):
p = s.split('.', 1) if s else [None]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment