提交 16f6f588 编写于 作者: I Ivo De Decker

Explicitly turn {items,keys,values}() into list where needed

In python3, these are iterators, which is fine in most situations. This
commit changes that places where it's not.
上级 9068eb88
......@@ -237,7 +237,7 @@ SELECT s.source FROM source s
'component_id': component_id, 'priority_id': source_priority_id,
'section_id': i[2], 'type_id': dsc_type_id, 'maintainer': i[3]})
for package, hasoverride in src_packages.items():
for package, hasoverride in list(src_packages.items()):
if not hasoverride:
utils.warn("%s has no override!" % package)
......@@ -310,7 +310,7 @@ SELECT s.source FROM source s
'component_id': component_id, 'priority_id': i[1],
'section_id': i[2], 'type_id': type_id, 'maintainer': i[3]})
for package, hasoverride in packages.items():
for package, hasoverride in list(packages.items()):
if not hasoverride:
utils.warn("%s has no override!" % package)
......@@ -343,11 +343,11 @@ def main():
# We need forward and reverse
sections = get_sections(session)
for name, entry in sections.items():
for name, entry in list(sections.items()):
sections[entry] = name
priorities = get_priorities(session)
for name, entry in priorities.items():
for name, entry in list(priorities.items()):
priorities[entry] = name
if not Options["No-Action"]:
......
......@@ -262,7 +262,7 @@ def read_control(filename):
print(formatted_text("can't parse control info"))
raise
control_keys = control.keys()
control_keys = list(control.keys())
if "Pre-Depends" in control:
predepends_str = control["Pre-Depends"]
......@@ -323,7 +323,7 @@ def read_changes_or_dsc(suite, filename, session=None):
if m:
keysinorder.append(m.group(1))
for k in dsc.keys():
for k in list(dsc.keys()):
if k in ("build-depends", "build-depends-indep"):
dsc[k] = create_depends_string(suite, split_depends(dsc[k]), session)
elif k == "architecture":
......
......@@ -154,7 +154,7 @@ def main():
if not a.endswith(".changes"):
utils.fubar("not a .changes file: %s" % (a))
changesfiles[a] = 1
changes = changesfiles.keys()
changes = list(changesfiles.keys())
username = utils.getusername()
if username != "dak":
......@@ -191,7 +191,7 @@ def main():
acceptfilename = "%s/COMMENTS/ACCEPT.%s_%s" % (os.path.dirname(os.path.abspath(changes[0])), source, version)
acceptfiles[acceptfilename] = 1
print("Would create %s now and then go on to accept this package, if you allow me to." % (acceptfiles.keys()))
print("Would create %s now and then go on to accept this package, if you allow me to." % (list(acceptfiles.keys())))
if Options["No-Action"]:
sys.exit(0)
else:
......
......@@ -407,7 +407,7 @@ def process_queue(queue, log, rrd_dir):
per_source[source]["list"].append(upload)
per_source[source]["list"].sort(key=lambda x: x.changes.created, reverse=True)
# Determine oldest time and have note status for each source group
for source in per_source.keys():
for source in list(per_source.keys()):
source_list = per_source[source]["list"]
first = source_list[0]
oldest = time.mktime(first.changes.created.timetuple())
......@@ -428,7 +428,7 @@ def process_queue(queue, log, rrd_dir):
per_source[source]["note_state"] = 1 # some
else:
per_source[source]["note_state"] = 2 # all
per_source_items = per_source.items()
per_source_items = list(per_source.items())
per_source_items.sort(key=functools.cmp_to_key(sg_compare))
update_graph_database(rrd_dir, type, len(per_source_items), len(queue.uploads))
......
......@@ -174,7 +174,7 @@ def number_of_packages():
d[suite_id][arch_id] = d[suite_id][arch_id] + count
## Print the results
# Setup
suite_list = suites.values()
suite_list = list(suites.values())
suite_id_list = []
suite_arches = {}
for suite in suite_list:
......
......@@ -857,7 +857,7 @@ class ArchiveUpload(object):
new = True
# Check if we reference a file only in a tainted archive
files = self.changes.files.values()
files = list(self.changes.files.values())
if self.changes.source is not None:
files.extend(self.changes.source.files.values())
for f in files:
......
......@@ -387,7 +387,7 @@ class BinaryCheck(Check):
binaries = {binary.control['Package']: binary
for binary in upload.changes.binaries}
for name, binary in binaries.items():
for name, binary in list(binaries.items()):
if name in upload.changes.binary_names:
# Package is listed in Binary field. Everything is good.
pass
......@@ -604,7 +604,7 @@ class SourceCheck(Check):
except Exception as e:
raise Reject('{0}: APT could not parse {1} field: {2}'.format(dsc_fn, field, e))
rejects = utils.check_dsc_files(dsc_fn, control, source.files.keys())
rejects = utils.check_dsc_files(dsc_fn, control, list(source.files.keys()))
if len(rejects) > 0:
raise Reject("\n".join(rejects))
......
......@@ -983,7 +983,7 @@ class Keyring(object):
byuid = {}
byname = {}
any_invalid = False
for x in self.keys.keys():
for x in list(self.keys.keys()):
if "email" not in self.keys[x]:
any_invalid = True
self.keys[x]["uid"] = format % "invalid-uid"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册