Remove more unnecessary list generation. (trunk r6913)
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2007 02:34:17 +0000 (02:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2007 02:34:17 +0000 (02:34 -0000)
svn path=/main/branches/2.1.2/; revision=6932

pym/elog_modules/mod_custom.py
pym/elog_modules/mod_echo.py
pym/elog_modules/mod_mail_summary.py
pym/getbinpkg.py
pym/portage_locks.py
pym/portage_manifest.py

index d609e79ba6aeae45589bae06e15e2d6e5ef3bbbe..90b974f67870203b67307175cc8a8801a7156253 100644 (file)
@@ -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"]
index a120d17c9f2c316bd9826505f20349f114eb01cb..55d33bb1f479b883a6f13f16df422a10ddee0f1c 100644 (file)
@@ -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
index 5e642f418da6e65cf4396f349bda2475a4cced42..783d7319652c142dabe20dc58675f8a9cb957e16 100644 (file)
@@ -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())
index 462da429d27ae766ec9f65183c44eaf53a3a5d60..8c42c42bf12f3e38d56efc321367914921e4fdaf 100644 (file)
@@ -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
index 8358b3063e7213092e81fd99330ea7b1963016b3..9b17c60e3c96c2cb16e1a66b57696e8c7c9fffe4 100644 (file)
@@ -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:
index c0f8bef9d158f6462e40e97dc6cc1a9653841f29..a8df77f43bc0d11b8592cbaa00b02a444d02e75a 100644 (file)
@@ -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]