[diffoscope] 01/05: Tidy comparators/missing_file.py

Chris Lamb chris at chris-lamb.co.uk
Wed Dec 28 13:45:09 CET 2016


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

lamby pushed a commit to branch master
in repository diffoscope.

commit a58c54aa3c2cc7a8827931602fdf611db2f428ca
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Dec 28 12:36:55 2016 +0000

    Tidy comparators/missing_file.py
---
 diffoscope/comparators/missing_file.py | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/diffoscope/comparators/missing_file.py b/diffoscope/comparators/missing_file.py
index fb9cde8..89712ad 100644
--- a/diffoscope/comparators/missing_file.py
+++ b/diffoscope/comparators/missing_file.py
@@ -23,12 +23,14 @@ from diffoscope import logger
 from diffoscope.config import Config
 from diffoscope.difference import Difference
 
-from .utils.file import File
 from .binary import FilesystemFile
+from .utils.file import File
 
 
 class MissingFile(File):
-    """Represents a missing file when comparing containers"""
+    """
+    Represents a missing file when comparing containers.
+    """
 
     @staticmethod
     def recognizes(file):
@@ -66,15 +68,24 @@ class MissingFile(File):
         return False
 
     def compare(self, other, source=None):
-        # So now that comparators are all object-oriented, we don't have any clue on how to
-        # perform a meaningful comparison right here. So we are good do the comparison backward
-        # (where knowledge of the file format lies) and and then reverse it.
+        # So now that comparators are all object-oriented, we don't have any
+        # clue on how to perform a meaningful comparison right here. So we are
+        # good do the comparison backward (where knowledge of the file format
+        # lies) and and then reverse it.
         if isinstance(other, MissingFile):
-            return Difference(None, self.name, other.name, comment='Trying to compare two non-existing files.')
-        logger.debug('Performing backward comparison')
+            return Difference(
+                None,
+                self.name,
+                other.name,
+                comment="Trying to compare two non-existing files."
+            )
+
+        logger.debug("Performing backward comparison")
         backward_diff = other.compare(self, source)
+
         if not backward_diff:
             return None
+
         return backward_diff.get_reverse()
 
     # Be nice to text comparisons
@@ -97,4 +108,3 @@ class MissingFile(File):
         class DummyChanges(dict):
             get_as_string = lambda self, _: ''
         return DummyChanges(Files=[], Version='')
-

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


More information about the diffoscope mailing list