[diffoscope] 01/01: comparators.apk: Rewrite nested loop with writelines.

Chris Lamb chris at chris-lamb.co.uk
Sun Jan 15 04:12:17 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 1729c610a9b6f1bbe0063dcae67d4e07844b3100
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Jan 15 14:10:36 2017 +1100

    comparators.apk: Rewrite nested loop with writelines.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/apk.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/diffoscope/comparators/apk.py b/diffoscope/comparators/apk.py
index f050560..dc65302 100644
--- a/diffoscope/comparators/apk.py
+++ b/diffoscope/comparators/apk.py
@@ -113,11 +113,8 @@ def filter_apk_metadata(filepath, archive_name):
         r'^apkFileName: %s' % re.escape(os.path.basename(archive_name)),
     )
 
-    with open(filepath) as in_:
-        with open(new_filename, 'w') as out:
-            for line in in_:
-                if not re_filename.match(line):
-                    out.write(line)
+    with open(filepath) as in_, open(new_filename, 'w') as out:
+        out.writelines(x for x in in_ if not re_filename.match(x))
 
     os.remove(filepath)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list