[Piuparts-devel] [Git][debian/piuparts][legoktm-patches-1] pkgsummary.py: Port to Python 3 and minor cleanup

Kunal Mehta gitlab at salsa.debian.org
Tue Jul 30 07:55:19 BST 2019



Kunal Mehta pushed to branch legoktm-patches-1 at Debian / piuparts


Commits:
42a29939 by Kunal Mehta at 2019-07-30T06:54:24Z
pkgsummary.py: Port to Python 3 and minor cleanup

* Use dict.items() since .iteritems() is gone in Python 3
* Remove redundant parenthesis
* Use "foo not in bar"

- - - - -


1 changed file:

- piupartslib/pkgsummary.py


Changes:

=====================================
piupartslib/pkgsummary.py
=====================================
@@ -117,7 +117,7 @@ flaginfo = {
                           ]),
 }
 
-state2flg = dict([(y, x[0]) for x in flaginfo.iteritems() for y in x[1].states])
+state2flg = dict([(y, x[0]) for x in flaginfo.items() for y in x[1].states])
 
 
 def worst_flag(*flags):
@@ -135,7 +135,7 @@ def get_flag(state):
     except KeyError:
         raise SummaryException("Unknown state - " + state)
 
-    return(flag)
+    return flag
 
 
 def new_summary():
@@ -146,7 +146,7 @@ def new_summary():
     dfltentry = ['-', 0, 'invalid url']
     pkgstruct = defaultdict(lambda: defaultdict(lambda: dfltentry))
 
-    return({
+    return {
         "_id": SUMMID,
                "_version": SUMMVER,
                "_date": utcdate,
@@ -155,11 +155,11 @@ def new_summary():
                             "develop/piupartslib/pkgsummary.py",
                "_type": "source",
                "packages": pkgstruct,
-    })
+    }
 
 
 def add_summary(summary, rep_sec, pkg, flag, block_cnt, url):
-    if not flag in flaginfo or not isinstance(block_cnt, int) \
+    if flag not in flaginfo or not isinstance(block_cnt, int) \
             or not url.startswith('http'):
         raise SummaryException("Invalid summary argument")
 



View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/42a2993958893d22025fe24cc54a7fd0250e0a05

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/42a2993958893d22025fe24cc54a7fd0250e0a05
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20190730/95e9e551/attachment-0001.html>


More information about the Piuparts-devel mailing list