From 74d1ad697e82601bf8aa44b0d24121017071e655 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 22 Sep 2009 21:26:20 +0000 Subject: Replace dict.keys() usage with __iter__(), since it behaves identically in both python 2.x and 3.x. svn path=/main/trunk/; revision=14384 --- pym/portage/checksum.py | 2 +- pym/portage/dbapi/bintree.py | 2 +- pym/portage/dbapi/porttree.py | 4 ++-- pym/portage/dbapi/vartree.py | 10 +++++----- pym/portage/dbapi/virtual.py | 2 +- pym/portage/elog/__init__.py | 2 +- pym/portage/elog/mod_mail.py | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'pym') diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index 9cc2d82e7..6b849d5d7 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -134,7 +134,7 @@ def perform_all(x, calc_prelink=0): return mydict def get_valid_checksum_keys(): - return list(hashfunc_map.keys()) + return list(hashfunc_map) def get_hash_origin(hashtype): if hashtype not in hashfunc_map: diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 79a6e5401..76447bf61 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -783,7 +783,7 @@ class binarytree(object): self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size) #writemsg(green(" -- DONE!\n\n")) - for mypkg in self.remotepkgs.keys(): + for mypkg in list(self.remotepkgs): if "CATEGORY" not in self.remotepkgs[mypkg]: #old-style or corrupt package writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 7f20e66fd..b073e4268 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -876,7 +876,7 @@ class portdbapi(dbapi): y == "CVS": continue d[x+"/"+y] = None - l = list(d.keys()) + l = list(d) l.sort() return l @@ -933,7 +933,7 @@ class portdbapi(dbapi): (mycp, self.mysettings["PORTAGE_CONFIGROOT"]), noiselevel=-1) mylist = [] else: - mylist = list(d.keys()) + mylist = list(d) # Always sort in ascending order here since it's handy # and the result can be easily cached and reused. self._cpv_sort_ascending(mylist) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index be69aab09..2bbc0f88a 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -153,7 +153,7 @@ class PreservedLibsRegistry(object): os = _os_merge - for cps in self._data.keys(): + for cps in list(self._data): cpv, counter, paths = self._data[cps] paths = [f for f in paths \ if os.path.exists(os.path.join(self._root, f.lstrip(os.sep)))] @@ -1020,7 +1020,7 @@ class vardbapi(dbapi): self.invalidentry(self.getpath(y)) continue d[mysplit[0]+"/"+mysplit[1]] = None - return list(d.keys()) + return list(d) def checkblockers(self, origdep): pass @@ -1093,7 +1093,7 @@ class vardbapi(dbapi): secpass >= 2: self._owners.populate() # index any unindexed contents valid_nodes = set(self.cpv_all()) - for cpv in self._aux_cache["packages"].keys(): + for cpv in list(self._aux_cache["packages"]): if cpv not in valid_nodes: del self._aux_cache["packages"][cpv] del self._aux_cache["modified"] @@ -2360,7 +2360,7 @@ class dblink(object): if pkgfiles: self.updateprotect() - mykeys = list(pkgfiles.keys()) + mykeys = list(pkgfiles) mykeys.sort() mykeys.reverse() @@ -4429,7 +4429,7 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None): curval = 0 if onProgress: onProgress(maxval, 0) - paths = list(contents.keys()) + paths = list(contents) paths.sort() for path in paths: curval += 1 diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py index 5d1e933a1..6c567a072 100644 --- a/pym/portage/dbapi/virtual.py +++ b/pym/portage/dbapi/virtual.py @@ -59,7 +59,7 @@ class fakedbapi(dbapi): return list(self.cpdict) def cpv_all(self): - return list(self.cpvdict.keys()) + return list(self.cpvdict) def cpv_inject(self, mycpv, metadata=None): """Adds a cpv to the list of available packages. See the diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 53c0a85f7..15e8c9bce 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -100,7 +100,7 @@ def elog_process(cpv, mysettings, phasefilter=None): else: all_logentries[cpv] = ebuild_logentries - for key in list(_preserve_logentries.keys()): + for key in list(_preserve_logentries): if key in all_logentries: all_logentries[key] = _merge_logentries(_preserve_logentries[key], all_logentries[key]) else: diff --git a/pym/portage/elog/mod_mail.py b/pym/portage/elog/mod_mail.py index ac96f3b20..96e45ba21 100644 --- a/pym/portage/elog/mod_mail.py +++ b/pym/portage/elog/mod_mail.py @@ -22,14 +22,14 @@ def process(mysettings, key, logentries, fulltext): # look at the phases listed in our logentries to figure out what action was performed action = _("merged") - for phase in logentries.keys(): + for phase in logentries: # if we found a *rm phase assume that the package was unmerged if phase in ["postrm", "prerm"]: action = _("unmerged") # if we think that the package was unmerged, make sure there was no unexpected # phase recorded to avoid misinformation if action == _("unmerged"): - for phase in logentries.keys(): + for phase in logentries: if phase not in ["postrm", "prerm", "other"]: action = _("unknown") -- cgit v1.2.3-1-g7c22