[diffoscope] 01/01: Tidy Iso9660File.recognizes

Chris Lamb chris at chris-lamb.co.uk
Tue Mar 21 13:17:02 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 2e1876152dca735c638bab97375c3c9a6c581dbb
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Mar 21 12:05:36 2017 +0000

    Tidy Iso9660File.recognizes
    
    Gbp-Dch: ignore
---
 diffoscope/comparators/iso9660.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/diffoscope/comparators/iso9660.py b/diffoscope/comparators/iso9660.py
index 80d15ed..b354c74 100644
--- a/diffoscope/comparators/iso9660.py
+++ b/diffoscope/comparators/iso9660.py
@@ -73,15 +73,18 @@ class Iso9660File(File):
 
     @classmethod
     def recognizes(cls, file):
-        if file.magic_file_type and cls.RE_FILE_TYPE.search(file.magic_file_type):
+        if file.magic_file_type and \
+                cls.RE_FILE_TYPE.search(file.magic_file_type):
             return True
-        else:
-            # sometimes CDs put things like MBRs at the front, which is an expected
-            # part of the ISO9660 standard, but file(1)/libmagic doesn't detect this
-            # see https://en.wikipedia.org/wiki/ISO_9660#Specifications for detais
-            with open(file.path, "rb") as fp:
-                fp.seek(32769)
-                return fp.read(5) == b'CD001'
+
+        # Sometimes CDs put things like MBRs at the front which is an expected
+        # part of the ISO9660 standard, but file(1)/libmagic doesn't detect
+        # this. <https://en.wikipedia.org/wiki/ISO_9660#Specifications>.
+        with open(file.path, 'rb') as f:
+            f.seek(32769)
+            return f.read(5) == b'CD001'
+
+        return False
 
     def compare_details(self, other, source=None):
         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