public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ali Polatel <hawking@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] [PATCH 4/6] Replace has_key() with the in operator (portage.elog)
Date: Tue,  1 Jul 2008 14:26:52 +0300	[thread overview]
Message-ID: <1214911614-31263-4-git-send-email-hawking@gentoo.org> (raw)
In-Reply-To: <1214911614-31263-3-git-send-email-hawking@gentoo.org>

---
 pym/portage/elog/__init__.py         |    4 ++--
 pym/portage/elog/filtering.py        |    2 +-
 pym/portage/elog/messages.py         |    4 ++--
 pym/portage/elog/mod_mail.py         |    2 +-
 pym/portage/elog/mod_mail_summary.py |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py
index 3039370..ea81e84 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 c93085c..d33d312 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 2daacd1..ac8d701 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 09e3db2..d6383a4 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 8f7f862..ed51473 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"
-- 
1.5.6.1

-- 
gentoo-portage-dev@lists.gentoo.org mailing list



  reply	other threads:[~2008-07-01 11:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 11:26 [gentoo-portage-dev] [PATCH 1/6] Replace has_key() with the in operator (portage) Ali Polatel
2008-07-01 11:26 ` [gentoo-portage-dev] [PATCH 2/6] Replace has_key() with the in operator (portage.cache) Ali Polatel
2008-07-01 11:26   ` [gentoo-portage-dev] [PATCH 3/6] Replace has_key() with the in operator (portage.dbapi) Ali Polatel
2008-07-01 11:26     ` Ali Polatel [this message]
2008-07-01 11:26       ` [gentoo-portage-dev] [PATCH 5/6] Replace has_key() with the in operator (bin) Ali Polatel
2008-07-01 11:26         ` [gentoo-portage-dev] [PATCH 6/6] Add deprecation warnings to classes that have has_key() methods Ali Polatel
2008-07-01 12:09           ` [gentoo-portage-dev] " Ali Polatel
2008-07-01 18:35             ` Alec Warner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1214911614-31263-4-git-send-email-hawking@gentoo.org \
    --to=hawking@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox