[diffoscope] 01/03: comparators.image: Inline attributes; only applies to this command so we can remove the namespace.

Chris Lamb chris at chris-lamb.co.uk
Sun Jan 15 02:26:35 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 42474675a62382f31b90303f13fae453628b71cf
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Jan 15 11:13:12 2017 +1100

    comparators.image: Inline attributes; only applies to this command so we can remove the namespace.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/image.py | 45 ++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/diffoscope/comparators/image.py b/diffoscope/comparators/image.py
index b039362..ad6d654 100644
--- a/diffoscope/comparators/image.py
+++ b/diffoscope/comparators/image.py
@@ -28,26 +28,6 @@ from .utils.file import File
 from .utils.command import Command
 
 re_ansi_escapes = re.compile(r'\x1b[^m]*m')
-identify_attributes = '\n'.join(('Image format: %m',
-                                 'File size: %b',
-                                 'Height: %[height]',
-                                 'Width: %[width]',
-                                 'Orientation: %[orientation]',
-                                 'Compression type: %[compression]',
-                                 'Compression quality: %[quality]',
-                                 'Colorspace: %[colorspace]',
-                                 'Channels: %[channels]',
-                                 'Depth: %[depth]',
-                                 'Interlace mode: %[interlace]',
-                                 'Rendering intent: %[rendering-intent]',
-                                 'X resolution: %[resolution.x]',
-                                 'Y resolution: %[resolution.y]',
-                                 'Resolution units: %[units]',
-                                 'Transparency channel enabled: %A',
-                                 'Gamma: %[gamma]',
-                                 'Number of unique colors: %[colors]',
-                                 'Comment: %c',
-                                 'EXIF data: %[EXIF:*]'))
 
 
 class Img2Txt(Command):
@@ -65,12 +45,35 @@ class Img2Txt(Command):
         return re_ansi_escapes.sub('', line.decode('utf-8')).encode('utf-8')
 
 class Identify(Command):
+    ATTRIBUTES = (
+        'Image format: %m',
+        'File size: %b',
+        'Height: %[height]',
+        'Width: %[width]',
+        'Orientation: %[orientation]',
+        'Compression type: %[compression]',
+        'Compression quality: %[quality]',
+        'Colorspace: %[colorspace]',
+        'Channels: %[channels]',
+        'Depth: %[depth]',
+        'Interlace mode: %[interlace]',
+        'Rendering intent: %[rendering-intent]',
+        'X resolution: %[resolution.x]',
+        'Y resolution: %[resolution.y]',
+        'Resolution units: %[units]',
+        'Transparency channel enabled: %A',
+        'Gamma: %[gamma]',
+        'Number of unique colors: %[colors]',
+        'Comment: %c',
+        'EXIF data: %[EXIF:*]',
+    )
+
     @tool_required('identify')
     def cmdline(self):
         return [
             'identify',
             '-format',
-            identify_attributes,
+            '\n'.join(self.ATTRIBUTES),
             self.path,
         ]
 

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


More information about the diffoscope mailing list