[Piuparts-devel] [Git][debian/piuparts][develop] make_kprs func - do not concat str, simplify 'if' statement

Holger Levsen gitlab at salsa.debian.org
Tue Feb 5 19:27:38 GMT 2019


Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
ac533808 by hpfn at 2019-02-05T19:27:18Z
make_kprs func - do not concat str, simplify 'if' statement

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


2 changed files:

- debian/changelog
- piupartslib/dwke.py


Changes:

=====================================
debian/changelog
=====================================
@@ -16,6 +16,7 @@ piuparts (0.97) UNRELEASED; urgency=medium
               not necessary here.
               list.sort() sorts the list in place.
               Save some memory
+       - make_kprs function: do not concat str, simplify 'if' statement.
 
  -- Holger Levsen <holger at debian.org>  Sun, 13 Jan 2019 16:58:44 +0100
 


=====================================
piupartslib/dwke.py
=====================================
@@ -253,13 +253,14 @@ def make_kprs(logdict, kprdict, problem_list):
 
             where = get_where(logpath)
 
-            kprs = ""
-            for problem in problem_list:
-                if problem.has_problem(logbody, where):
-                    kprs += "%s/%s.log %s\n" % (where, pkg_spec, problem.name)
+            kprs = ["%s/%s.log %s\n" % (where, pkg_spec, problem.name)
+                    for problem in problem_list
+                    if problem.has_problem(logbody, where)]
 
-            if not where in ['pass'] and not len(kprs):
-                kprs += "%s/%s.log %s\n" % (where, pkg_spec, "unclassified_failures.conf")
+            kprs = ''.join(kprs)
+
+            if where != 'pass' and not kprs:
+                kprs = "%s/%s.log %s\n" % (where, pkg_spec, "unclassified_failures.conf")
 
             with open(get_kpr_path(logpath), 'w') as f:
                 f.write(kprs)



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

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/ac5338081b30b783b375ac81721f2959f1116598
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/20190205/b18511c8/attachment-0001.html>


More information about the Piuparts-devel mailing list