diff options
-rw-r--r-- | pym/portage/elog/__init__.py | 5 | ||||
-rw-r--r-- | pym/portage/elog/filtering.py | 2 | ||||
-rw-r--r-- | pym/portage/elog/messages.py | 2 | ||||
-rw-r--r-- | pym/portage/elog/mod_custom.py | 3 | ||||
-rw-r--r-- | pym/portage/elog/mod_echo.py | 2 | ||||
-rw-r--r-- | pym/portage/elog/mod_mail_summary.py | 2 | ||||
-rw-r--r-- | pym/portage/getbinpkg.py | 3 | ||||
-rw-r--r-- | pym/portage/locks.py | 4 | ||||
-rw-r--r-- | pym/portage/manifest.py | 7 | ||||
-rw-r--r-- | pym/portage/tests/env/config/test_PackageMaskFile.py | 3 | ||||
-rw-r--r-- | pym/portage/tests/env/config/test_PortageModulesFile.py | 2 | ||||
-rw-r--r-- | pym/portage/tests/util/test_varExpand.py | 2 |
12 files changed, 18 insertions, 19 deletions
diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 77bdd1b94..5b8ac44c3 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -15,7 +15,8 @@ import os def _merge_logentries(a, b): rValue = {} - phases = set(a.keys()+b.keys()) + phases = set(a) + phases.update(b) for p in phases: rValue[p] = [] if a.has_key(p): @@ -51,7 +52,7 @@ def elog_process(cpv, mysettings): my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) - for key in all_logentries.keys(): + for key in all_logentries: default_logentries = filter_loglevels(all_logentries[key], my_elog_classes) # in case the filters matched all messages and no module overrides exist diff --git a/pym/portage/elog/filtering.py b/pym/portage/elog/filtering.py index f4748fede..e8a5430fd 100644 --- a/pym/portage/elog/filtering.py +++ b/pym/portage/elog/filtering.py @@ -7,7 +7,7 @@ def filter_loglevels(logentries, loglevels): # remove unwanted entries from all logentries rValue = {} loglevels = map(str.upper, loglevels) - for phase in logentries.keys(): + for phase in logentries: for msgtype, msgcontent in logentries[phase]: if msgtype.upper() in loglevels or "*" in loglevels: if not rValue.has_key(phase): diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py index bfe428030..c2b21ac80 100644 --- a/pym/portage/elog/messages.py +++ b/pym/portage/elog/messages.py @@ -84,6 +84,6 @@ def _make_msgfunction(level, color): return _elog import sys -for f in _functions.keys(): +for f in _functions: setattr(sys.modules[__name__], f, _make_msgfunction(_functions[f][0], _functions[f][1])) del f, _functions diff --git a/pym/portage/elog/mod_custom.py b/pym/portage/elog/mod_custom.py index a486c8931..09d981a0c 100644 --- a/pym/portage/elog/mod_custom.py +++ b/pym/portage/elog/mod_custom.py @@ -8,8 +8,7 @@ import portage.elog_modules.mod_save, portage.process, portage.exception def process(mysettings, key, logentries, fulltext): elogfilename = portage.elog_modules.mod_save.process(mysettings, key, 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/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py index 125a8c40e..6dcc65233 100644 --- a/pym/portage/elog/mod_echo.py +++ b/pym/portage/elog/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/portage/elog/mod_mail_summary.py b/pym/portage/elog/mod_mail_summary.py index a8e694935..0a39b17b1 100644 --- a/pym/portage/elog/mod_mail_summary.py +++ b/pym/portage/elog/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 key in _items.keys(): + for key in _items: mybody += "- %s\n" % key mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, mybody, attachments=_items.values()) diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index f44f690a6..410a48577 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/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 2575a978b..19c7352b7 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -284,13 +284,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 cd03dc293..5add55c81 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] @@ -345,9 +344,9 @@ class Manifest(object): pass def checkIntegrity(self): - for t in self.fhashdict.keys(): + for t in self.fhashdict: for f in self.fhashdict[t]: - if not portage.const.MANIFEST2_REQUIRED_HASH in self.fhashdict[t][f].keys(): + if portage.const.MANIFEST2_REQUIRED_HASH not in self.fhashdict[t][f]: raise MissingParameter("Missing %s checksum: %s %s" % (portage.const.MANIFEST2_REQUIRED_HASH, t, f)) def write(self, sign=False, force=False): diff --git a/pym/portage/tests/env/config/test_PackageMaskFile.py b/pym/portage/tests/env/config/test_PackageMaskFile.py index ad87d5a56..e8357f7e6 100644 --- a/pym/portage/tests/env/config/test_PackageMaskFile.py +++ b/pym/portage/tests/env/config/test_PackageMaskFile.py @@ -18,7 +18,8 @@ class PackageMaskFileTestCase(TestCase): try: f = PackageMaskFile(self.fname) f.load() - [atom for atom in f.keys() if self.assertTrue(atom in self.atoms)] + for atom in f: + self.assertTrue(atom in self.atoms) finally: self.NukeFile() diff --git a/pym/portage/tests/env/config/test_PortageModulesFile.py b/pym/portage/tests/env/config/test_PortageModulesFile.py index b523cbe7b..03104cff5 100644 --- a/pym/portage/tests/env/config/test_PortageModulesFile.py +++ b/pym/portage/tests/env/config/test_PortageModulesFile.py @@ -18,7 +18,7 @@ class PortageModulesFileTestCase(TestCase): def testPortageModulesFile(self): self.BuildFile() f = PortageModulesFile(self.fname) - for k in f.keys(): + for k in f: self.assertEqual( f[k], self.items[k] ) self.NukeFile() diff --git a/pym/portage/tests/util/test_varExpand.py b/pym/portage/tests/util/test_varExpand.py index ee0f573c9..e4f85ef43 100644 --- a/pym/portage/tests/util/test_varExpand.py +++ b/pym/portage/tests/util/test_varExpand.py @@ -11,7 +11,7 @@ class VarExpandTestCase(TestCase): def testVarExpandPass(self): varDict = { "a":"5", "b":"7", "c":"-5" } - for key in varDict.keys(): + for key in varDict: result = varexpand( "$%s" % key, varDict ) self.failIf( result != varDict[key], |