From e69048855fb3bf1eee6eed93dc97dabd29a289ac Mon Sep 17 00:00:00 2001 From: Brian May Date: Tue, 5 Mar 2019 16:59:27 +1100 Subject: Force keys() to get evaluated as list Under Python 3, keys() doesn't return a list (as in Python 2), but must be evaluated before it can be used as a list. --- lib/python/bugs.py | 2 +- lib/python/debian_support.py | 2 +- lib/python/security_db.py | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/python/bugs.py b/lib/python/bugs.py index 0ef8266e42..0c94d4aff3 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -287,7 +287,7 @@ class Bug(BugBase): notes[key].merge(n) else: notes[key] = n - l = notes.keys() + l = list(notes.keys()) # The release part of a key can be None, so we have to deal # with that when sorting. diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py index d405440e9f..b2e0d60956 100644 --- a/lib/python/debian_support.py +++ b/lib/python/debian_support.py @@ -419,7 +419,7 @@ def mergeAsSets(*args): for x in args: for y in x: s[y] = True - l = s.keys() + l = list(s.keys()) l.sort() return l diff --git a/lib/python/security_db.py b/lib/python/security_db.py index 2404549a79..a59e0430ed 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -77,7 +77,7 @@ def mergeLists(a, b): result[x] = 1 for x in b: result[x] = 1 - result = result.keys() + result = list(result.keys()) result.sort() return result @@ -554,7 +554,7 @@ class DB: for arch in arg.split(','): lst[arch] = True def string_set_to_archs(lst): - l = lst.keys() + l = list(lst.keys()) l.sort() return ','.join(l) def string_set_factory(): @@ -835,7 +835,7 @@ class DB: cursor.execute("DELETE FROM binary_packages") self._clearVersions(cursor) - l = packages.keys() + l = list(packages.keys()) if len(l) == 0: raise ValueError("no binary packages found") @@ -843,7 +843,7 @@ class DB: l.sort() def gen(): for key in l: - archs = packages[key].keys() + archs = list(packages[key].keys()) archs.sort() archs = ','.join(archs) yield key + (archs,) @@ -1393,11 +1393,11 @@ class DB: elif vulnerable == 2: undet_pkgs[package] = True - unfixed_pkgs = unfixed_pkgs.keys() + unfixed_pkgs = list(unfixed_pkgs.keys()) unfixed_pkgs.sort() - undet_pkgs = undet_pkgs.keys() + undet_pkgs = list(undet_pkgs.keys()) undet_pkgs.sort() - unimp_pkgs = unimp_pkgs.keys() + unimp_pkgs = list(unimp_pkgs.keys()) unimp_pkgs.sort() pkgs = "" @@ -1689,7 +1689,7 @@ class DB: elif is_unknown: bs_flag = ' ' - other_versions = other_versions.keys() + other_versions = list(other_versions.keys()) other_versions.sort() other_versions = ' '.join(other_versions) @@ -1701,7 +1701,7 @@ class DB: ",%s,%s" % (unstable_fixed, other_versions))) fill_vuln_list() - source_packages = source_packages.keys() + source_packages = list(source_packages.keys()) source_packages.sort() def store_value(name, value): -- cgit v1.2.3