From: Zac Medico Date: Fri, 22 Jun 2007 02:34:17 +0000 (-0000) Subject: Remove more unnecessary list generation. (trunk r6913) X-Git-Tag: v2.1.3~178 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=05e710dc0187255e2bd7e8ab7480e3ce1ce6fde4;p=portage.git Remove more unnecessary list generation. (trunk r6913) svn path=/main/branches/2.1.2/; revision=6932 --- diff --git a/pym/elog_modules/mod_custom.py b/pym/elog_modules/mod_custom.py index d609e79ba..90b974f67 100644 --- a/pym/elog_modules/mod_custom.py +++ b/pym/elog_modules/mod_custom.py @@ -3,8 +3,7 @@ import elog_modules.mod_save, portage_exec, portage_exception def process(mysettings, cpv, logentries, fulltext): elogfilename = elog_modules.mod_save.process(mysettings, cpv, logentries, fulltext) - if (not "PORTAGE_ELOG_COMMAND" in mysettings.keys()) \ - or len(mysettings["PORTAGE_ELOG_COMMAND"]) == 0: + if not mysettings.get("PORTAGE_ELOG_COMMAND"): raise portage_exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined") else: mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"] diff --git a/pym/elog_modules/mod_echo.py b/pym/elog_modules/mod_echo.py index a120d17c9..55d33bb1f 100644 --- a/pym/elog_modules/mod_echo.py +++ b/pym/elog_modules/mod_echo.py @@ -12,7 +12,7 @@ def process(mysettings, key, logentries, fulltext): def finalize(mysettings): printer = EOutput() - for key in _items.keys(): + for key in _items: print printer.einfo("Messages for package %s:" % key) print diff --git a/pym/elog_modules/mod_mail_summary.py b/pym/elog_modules/mod_mail_summary.py index 5e642f418..783d73196 100644 --- a/pym/elog_modules/mod_mail_summary.py +++ b/pym/elog_modules/mod_mail_summary.py @@ -31,7 +31,7 @@ def finalize(mysettings): mybody = "elog messages for the following packages generated by " + \ "process %d on host %s:\n" % (os.getpid(), socket.getfqdn()) - for cpv in _items.keys(): + for cpv in _items: mybody += "- %s\n" % cpv mymessage = portage_mail.create_message(myfrom, myrecipient, mysubject, mybody, attachments=_items.values()) diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py index 462da429d..8c42c42bf 100644 --- a/pym/getbinpkg.py +++ b/pym/getbinpkg.py @@ -515,8 +515,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= for x in tbz2list: x = os.path.basename(x) binpkg_filenames.add(x) - if ((not metadata[baseurl]["data"].has_key(x)) or \ - (x not in metadata[baseurl]["data"].keys())): + if x not in metadata[baseurl]["data"]: sys.stderr.write(yellow("x")) metadata[baseurl]["modified"] = 1 myid = None diff --git a/pym/portage_locks.py b/pym/portage_locks.py index 8358b3063..9b17c60e3 100644 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -288,13 +288,13 @@ def hardlock_cleanup(path, remove_all_locks=False): results.append("Found %(count)s locks" % {"count":mycount}) - for x in mylist.keys(): + for x in mylist: if mylist[x].has_key(myhost) or remove_all_locks: mylockname = hardlock_name(path+"/"+x) if hardlink_is_mine(mylockname, path+"/"+x) or \ not os.path.exists(path+"/"+x) or \ remove_all_locks: - for y in mylist[x].keys(): + for y in mylist[x]: for z in mylist[x][y]: filename = path+"/"+x+".hardlock-"+y+"-"+z if filename == mylockname: diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index c0f8bef9d..a8df77f43 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -79,8 +79,7 @@ class ManifestEntry(object): class Manifest1Entry(ManifestEntry): def __str__(self): - myhashkeys = self.hashes.keys() - for hashkey in myhashkeys: + for hashkey in self.hashes: if hashkey != "size": break hashvalue = self.hashes[hashkey]