[python-bugzilla] [PATCH 05/13] Do not mutate dict objects when iterating keys
abn at redhat.com
abn at redhat.com
Tue Oct 29 13:22:24 UTC 2013
From: Arun Babu Neelicattu <abn at redhat.com>
---
bin/bugzilla | 5 ++---
bugzilla/base.py | 4 +---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/bin/bugzilla b/bin/bugzilla
index 5b32030..b15730e 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -922,9 +922,8 @@ def _do_modify(bz, parser, opt, args):
"qa": (add_qawb, rm_qawb),
"devel": (add_devwb, rm_devwb),
}
- for key in wbmap.keys():
- if not wbmap[key][0] and not wbmap[key][1]:
- wbmap.pop(key)
+
+ wbmap = {k: v for k, v in wbmap.items() if wbmap[k][0] or wbmap[k][1]}
log.debug("update bug dict=%s", update)
log.debug("update flags dict=%s", flags)
diff --git a/bugzilla/base.py b/bugzilla/base.py
index 1756908..a4e30c1 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -973,9 +973,7 @@ class BugzillaBase(object):
}
# Strip out None elements in the dict
- for key in query.keys():
- if query[key] is None:
- del(query[key])
+ query = {k: v for k, v in query.items() if v is not None}
return query
def _query(self, query):
--
1.8.3.1
More information about the python-bugzilla
mailing list