Py3k compatibility patch #4 by Ali Polatel <hawking@g.o>.
authorZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 12:50:41 +0000 (12:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 12:50:41 +0000 (12:50 -0000)
Replace dict.has_key() calls with "in" and "not in" operators.

svn path=/main/trunk/; revision=10873

pym/portage/elog/__init__.py
pym/portage/elog/filtering.py
pym/portage/elog/messages.py
pym/portage/elog/mod_mail.py
pym/portage/elog/mod_mail_summary.py

index 3039370a3c0a41c214712b465752c1eb9a9e2fbe..ea81e841188b8f5a16908d57c21aaf0e7ac3abaa 100644 (file)
@@ -73,13 +73,13 @@ def elog_process(cpv, mysettings, phasefilter=None):
 
        ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging"))
        all_logentries = collect_messages()
-       if all_logentries.has_key(cpv):
+       if cpv in all_logentries:
                all_logentries[cpv] = _merge_logentries(ebuild_logentries, all_logentries[cpv])
        else:
                all_logentries[cpv] = ebuild_logentries
 
        for key in _preserve_logentries.keys():
-               if all_logentries.has_key(key):
+               if key in all_logentries:
                        all_logentries[key] = _merge_logentries(_preserve_logentries[key], all_logentries[key])
                else:
                        all_logentries[key] = _preserve_logentries[key]
index b41f64e48500ff18df23e607ba641e6e18fad45e..8a1852bd8fc023c44c033106f6aee0939d558b34 100644 (file)
@@ -12,7 +12,7 @@ def filter_loglevels(logentries, loglevels):
        for phase in logentries:
                for msgtype, msgcontent in logentries[phase]:
                        if msgtype.upper() in loglevels or "*" in loglevels:
-                               if not rValue.has_key(phase):
+                               if phase not in rValue:
                                        rValue[phase] = []
                                rValue[phase].append((msgtype, msgcontent))
        return rValue
index d33542ef1e455d94386231c392e09f8aba806a12..36116cc820fa11e038511c0c6613929d7a99d127 100644 (file)
@@ -76,9 +76,9 @@ def _elog_base(level, msg, phase="other", key=None, color=None):
        if color == None:
                color = "GOOD"
        print colorize(color, " * ")+msg
-       if not _msgbuffer.has_key(key):
+       if key not in _msgbuffer:
                _msgbuffer[key] = {}
-       if not _msgbuffer[key].has_key(phase):
+       if phase not in _msgbuffer[key]:
                _msgbuffer[key][phase] = []
        _msgbuffer[key][phase].append((level, msg))
 
index 09e3db22dcd7d321c23de5fe1db152ce23ac7757..d6383a4eb06b7bf2457cef5c7923a58c0d13eb16 100644 (file)
@@ -8,7 +8,7 @@ from portage.exception import PortageException
 from portage.util import writemsg
 
 def process(mysettings, key, logentries, fulltext):
-       if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
+       if "PORTAGE_ELOG_MAILURI" in mysettings:
                myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
        else:
                myrecipient = "root@localhost"
index 8f7f8621795d1698cb7e11e28016b3b756a41492..ed5147313ffbe567994731e873152dd1809eb358 100644 (file)
@@ -33,7 +33,7 @@ def _finalize(mysettings, items):
                count = "one package"
        else:
                count = "multiple packages"
-       if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
+       if "PORTAGE_ELOG_MAILURI" in mysettings:
                myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
        else:
                myrecipient = "root@localhost"