Gentoo Archives: gentoo-portage-dev

From: Ali Polatel <hawking@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH 4/6] Replace has_key() with the in operator (portage.elog)
Date: Tue, 01 Jul 2008 11:27:41
Message-Id: 1214911614-31263-4-git-send-email-hawking@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 3/6] Replace has_key() with the in operator (portage.dbapi) by Ali Polatel
1 ---
2 pym/portage/elog/__init__.py | 4 ++--
3 pym/portage/elog/filtering.py | 2 +-
4 pym/portage/elog/messages.py | 4 ++--
5 pym/portage/elog/mod_mail.py | 2 +-
6 pym/portage/elog/mod_mail_summary.py | 2 +-
7 5 files changed, 7 insertions(+), 7 deletions(-)
8
9 diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py
10 index 3039370..ea81e84 100644
11 --- a/pym/portage/elog/__init__.py
12 +++ b/pym/portage/elog/__init__.py
13 @@ -73,13 +73,13 @@ def elog_process(cpv, mysettings, phasefilter=None):
14
15 ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging"))
16 all_logentries = collect_messages()
17 - if all_logentries.has_key(cpv):
18 + if cpv in all_logentries:
19 all_logentries[cpv] = _merge_logentries(ebuild_logentries, all_logentries[cpv])
20 else:
21 all_logentries[cpv] = ebuild_logentries
22
23 for key in _preserve_logentries.keys():
24 - if all_logentries.has_key(key):
25 + if key in all_logentries:
26 all_logentries[key] = _merge_logentries(_preserve_logentries[key], all_logentries[key])
27 else:
28 all_logentries[key] = _preserve_logentries[key]
29 diff --git a/pym/portage/elog/filtering.py b/pym/portage/elog/filtering.py
30 index c93085c..d33d312 100644
31 --- a/pym/portage/elog/filtering.py
32 +++ b/pym/portage/elog/filtering.py
33 @@ -12,7 +12,7 @@ def filter_loglevels(logentries, loglevels):
34 for phase in logentries:
35 for msgtype, msgcontent in logentries[phase]:
36 if msgtype.upper() in loglevels or "*" in loglevels:
37 - if not rValue.has_key(phase):
38 + if phase not in rValue:
39 rValue[phase] = []
40 rValue[phase].append((msgtype, msgcontent))
41 return rValue
42 diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
43 index 2daacd1..ac8d701 100644
44 --- a/pym/portage/elog/messages.py
45 +++ b/pym/portage/elog/messages.py
46 @@ -76,9 +76,9 @@ def _elog_base(level, msg, phase="other", key=None, color=None):
47 if color == None:
48 color = "GOOD"
49 print colorize(color, " * ")+msg
50 - if not _msgbuffer.has_key(key):
51 + if key not in _msgbuffer:
52 _msgbuffer[key] = {}
53 - if not _msgbuffer[key].has_key(phase):
54 + if phase not in _msgbuffer[key]:
55 _msgbuffer[key][phase] = []
56 _msgbuffer[key][phase].append((level, msg))
57
58 diff --git a/pym/portage/elog/mod_mail.py b/pym/portage/elog/mod_mail.py
59 index 09e3db2..d6383a4 100644
60 --- a/pym/portage/elog/mod_mail.py
61 +++ b/pym/portage/elog/mod_mail.py
62 @@ -8,7 +8,7 @@ from portage.exception import PortageException
63 from portage.util import writemsg
64
65 def process(mysettings, key, logentries, fulltext):
66 - if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
67 + if "PORTAGE_ELOG_MAILURI" in mysettings:
68 myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
69 else:
70 myrecipient = "root@localhost"
71 diff --git a/pym/portage/elog/mod_mail_summary.py b/pym/portage/elog/mod_mail_summary.py
72 index 8f7f862..ed51473 100644
73 --- a/pym/portage/elog/mod_mail_summary.py
74 +++ b/pym/portage/elog/mod_mail_summary.py
75 @@ -33,7 +33,7 @@ def _finalize(mysettings, items):
76 count = "one package"
77 else:
78 count = "multiple packages"
79 - if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
80 + if "PORTAGE_ELOG_MAILURI" in mysettings:
81 myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
82 else:
83 myrecipient = "root@localhost"
84 --
85 1.5.6.1
86
87 --
88 gentoo-portage-dev@l.g.o mailing list

Replies