[diffoscope] 01/05: comparators.iso9660: Tidy class.

Chris Lamb chris at chris-lamb.co.uk
Tue Mar 14 18:59:51 CET 2017


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

lamby pushed a commit to branch experimental
in repository diffoscope.

commit 0c1c9ea5214468c8e6dd207ddd9cdc6edb036842
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Mar 14 11:24:51 2017 +0100

    comparators.iso9660: Tidy class.
    
    Dch-Gbp: ignore
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/iso9660.py | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/diffoscope/comparators/iso9660.py b/diffoscope/comparators/iso9660.py
index 389549a..db3134d 100644
--- a/diffoscope/comparators/iso9660.py
+++ b/diffoscope/comparators/iso9660.py
@@ -30,10 +30,13 @@ from .utils.libarchive import LibarchiveContainer
 
 @tool_required('isoinfo')
 def get_iso9660_names(path):
-    # We always use RockRidge for names. Let's see if this proves
-    # problematic later
-    cmd = ['isoinfo', '-R', '-f', '-i', path]
-    return subprocess.check_output(cmd, shell=False).strip().split('\n')
+    return subprocess.check_output((
+        'isoinfo',
+        '-R',  # Always use RockRidge for names
+        '-f',
+        '-i',
+        path,
+    ), shell=False).strip().split('\n')
 
 
 class ISO9660PVD(Command):
@@ -50,17 +53,18 @@ class ISO9660Listing(Command):
     @tool_required('isoinfo')
     def cmdline(self):
         cmd = ['isoinfo', '-l', '-i', self.path]
+
         if self._extension == 'joliet':
             cmd.extend(['-J', '-j', 'iso8859-15'])
         elif self._extension == 'rockridge':
             cmd.extend(['-R'])
+
         return cmd
 
     def filter(self, line):
         if self._extension == 'joliet':
             return line.decode('iso-8859-15').encode('utf-8')
-        else:
-            return line
+        return line
 
 
 class Iso9660File(File):
@@ -69,11 +73,19 @@ class Iso9660File(File):
 
     def compare_details(self, other, source=None):
         differences = []
-        differences.append(Difference.from_command(ISO9660PVD, self.path, other.path))
-        differences.append(Difference.from_command(ISO9660Listing, self.path, other.path))
-        for extension in ('joliet', 'rockridge'):
+
+        for klass in (ISO9660PVD, ISO9660Listing):
+            differences.append(Difference.from_command(
+                klass, self.path, other.path,
+            ))
+
+        for x in ('joliet', 'rockridge'):
             try:
-                differences.append(Difference.from_command(ISO9660Listing, self.path, other.path, command_args=(extension,)))
+                differences.append(Difference.from_command(
+                    ISO9660Listing, self.path, other.path, command_args=(x,),
+                ))
             except subprocess.CalledProcessError:
-                pass # probably no joliet or rockridge data
+                # Probably no joliet or rockridge data
+                pass
+
         return differences

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


More information about the diffoscope mailing list