From: Zac Medico Date: Tue, 1 Jul 2008 12:50:41 +0000 (-0000) Subject: Py3k compatibility patch #4 by Ali Polatel . X-Git-Tag: v2.2_rc2~253 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a4c79bdfd0b8e5a58ce1bfd181a41a8625370b73;p=portage.git Py3k compatibility patch #4 by Ali Polatel . Replace dict.has_key() calls with "in" and "not in" operators. svn path=/main/trunk/; revision=10873 --- diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 3039370a3..ea81e8411 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -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] diff --git a/pym/portage/elog/filtering.py b/pym/portage/elog/filtering.py index b41f64e48..8a1852bd8 100644 --- a/pym/portage/elog/filtering.py +++ b/pym/portage/elog/filtering.py @@ -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 diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py index d33542ef1..36116cc82 100644 --- a/pym/portage/elog/messages.py +++ b/pym/portage/elog/messages.py @@ -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)) diff --git a/pym/portage/elog/mod_mail.py b/pym/portage/elog/mod_mail.py index 09e3db22d..d6383a4eb 100644 --- a/pym/portage/elog/mod_mail.py +++ b/pym/portage/elog/mod_mail.py @@ -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" diff --git a/pym/portage/elog/mod_mail_summary.py b/pym/portage/elog/mod_mail_summary.py index 8f7f86217..ed5147313 100644 --- a/pym/portage/elog/mod_mail_summary.py +++ b/pym/portage/elog/mod_mail_summary.py @@ -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"