[Python-modules-commits] [python-exif] 08/19: format code / minor style improvements

Wolfgang Borgert debacle at moszumanska.debian.org
Mon Oct 6 22:18:38 UTC 2014


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

debacle pushed a commit to reference refs/remotes/upstream/develop
in repository python-exif.

commit 1cccbfe26302dd7bf0670e35967f584ab00da63c
Author: ianaré sévi <ianare at gmail.com>
Date:   Sat Dec 28 18:17:05 2013 +0100

    format code / minor style improvements
---
 exifread/__init__.py             | 109 +++---
 exifread/classes.py              |  80 ++--
 exifread/tags/exif.py            |   2 +-
 exifread/tags/makernote.py       | 818 +++++++++++++++++++++------------------
 exifread/tags/makernote_canon.py |   3 +
 exifread/utils.py                |   5 +-
 setup.py                         |   2 +-
 7 files changed, 542 insertions(+), 477 deletions(-)

diff --git a/exifread/__init__.py b/exifread/__init__.py
index 5434cb4..77863d9 100644
--- a/exifread/__init__.py
+++ b/exifread/__init__.py
@@ -13,7 +13,7 @@ logger = logging.getLogger('exifread')
 
 
 def increment_base(data, base):
-    return ord_(data[base+2]) * 256 + ord_(data[base+3]) + 2
+    return ord_(data[base + 2]) * 256 + ord_(data[base + 3]) + 2
 
 
 def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug=False):
@@ -45,14 +45,14 @@ def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug
         while ord_(data[2]) == 0xFF and data[6:10] in (b'JFIF', b'JFXX', b'OLYM', b'Phot'):
             length = ord_(data[4]) * 256 + ord_(data[5])
             logger.debug(" Length offset is %s", length)
-            f.read(length-8)
+            f.read(length - 8)
             # fake an EXIF beginning of file
             # I don't think this is used. --gd
             data = b'\xFF\x00' + f.read(10)
             fake_exif = 1
             if base > 2:
                 logger.debug(" Added to base")
-                base = base + length + 4 -2
+                base = base + length + 4 - 2
             else:
                 logger.debug(" Added to zero")
                 base = length + 4
@@ -65,113 +65,114 @@ def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug
         # base = 2
         while 1:
             logger.debug(" Segment base 0x%X", base)
-            if data[base:base+2] == b'\xFF\xE1':
+            if data[base:base + 2] == b'\xFF\xE1':
                 # APP1
                 logger.debug("  APP1 at base 0x%X", base)
-                logger.debug("  Length: 0x%X 0x%X", ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug("  Code: %s", data[base+4:base+8])
-                if data[base+4:base+8] == b"Exif":
+                logger.debug("  Length: 0x%X 0x%X", ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug("  Code: %s", data[base + 4:base + 8])
+                if data[base + 4:base + 8] == b"Exif":
                     logger.debug("  Decrement base by 2 to get to pre-segment header (for compatibility with later code)")
-                    base = base-2
+                    base -= 2
                     break
                 increment = increment_base(data, base)
                 logger.debug(" Increment base by %s", increment)
-                base = base + increment
-            elif data[base:base+2] == b'\xFF\xE0':
+                base += increment
+            elif data[base:base + 2] == b'\xFF\xE0':
                 # APP0
                 logger.debug("  APP0 at base 0x%X", base)
-                logger.debug("  Length: 0x%X 0x%X", ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug("  Code: %s", data[base+4:base+8])
+                logger.debug("  Length: 0x%X 0x%X", ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug("  Code: %s", data[base + 4:base + 8])
                 increment = increment_base(data, base)
                 logger.debug(" Increment base by %s", increment)
-                base = base + increment
-            elif data[base:base+2] == b'\xFF\xE2':
+                base +=  increment
+            elif data[base:base + 2] == b'\xFF\xE2':
                 # APP2
                 logger.debug("  APP2 at base 0x%X", base)
-                logger.debug("  Length: 0x%X 0x%X", ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug(" Code: %s", data[base+4:base+8])
+                logger.debug("  Length: 0x%X 0x%X", ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug(" Code: %s", data[base + 4:base + 8])
                 increment = increment_base(data, base)
                 logger.debug(" Increment base by %s", increment)
-                base = base + increment
-            elif data[base:base+2] == b'\xFF\xEE':
+                base += increment
+            elif data[base:base + 2] == b'\xFF\xEE':
                 # APP14
                 logger.debug("  APP14 Adobe segment at base 0x%X", base)
-                logger.debug("  Length: 0x%X 0x%X", ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug("  Code: %s", data[base+4:base+8])
+                logger.debug("  Length: 0x%X 0x%X", ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug("  Code: %s", data[base + 4:base + 8])
                 increment = increment_base(data, base)
                 logger.debug(" Increment base by %s", increment)
-                base = base + increment
+                base += increment
                 logger.debug("  There is useful EXIF-like data here, but we have no parser for it.")
-            elif data[base:base+2] == b'\xFF\xDB':
+            elif data[base:base + 2] == b'\xFF\xDB':
                 logger.debug("  JPEG image data at base 0x%X No more segments are expected.",
                              base)
                 break
-            elif data[base:base+2] == b'\xFF\xD8':
+            elif data[base:base + 2] == b'\xFF\xD8':
                 # APP12
                 logger.debug("  FFD8 segment at base 0x%X", base)
                 logger.debug("  Got 0x%X 0x%X and %s instead",
                              ord_(data[base]),
-                             ord_(data[base+1]),
-                             data[4+base:10+base])
-                logger.debug("  Length: 0x%X 0x%X", ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug("  Code: %s", data[base+4:base+8])
+                             ord_(data[base + 1]),
+                             data[4 + base:10 + base])
+                logger.debug("  Length: 0x%X 0x%X", ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug("  Code: %s", data[base + 4:base + 8])
                 increment = increment_base(data, base)
                 logger.debug("  Increment base by %s", increment)
-                base = base + increment
-            elif data[base:base+2] == b'\xFF\xEC':
+                base += increment
+            elif data[base:base + 2] == b'\xFF\xEC':
                 # APP12
                 logger.debug("  APP12 XMP (Ducky) or Pictureinfo segment at base 0x%X",
                              base)
                 logger.debug("  Got 0x%X and 0x%X instead", ord_(data[base]),
-                             ord_(data[base+1]))
+                             ord_(data[base + 1]))
                 logger.debug("  Length: 0x%X 0x%X",
-                             ord_(data[base+2]),
-                             ord_(data[base+3]))
-                logger.debug("Code: %s", data[base+4:base+8])
+                             ord_(data[base + 2]),
+                             ord_(data[base + 3]))
+                logger.debug("Code: %s", data[base + 4:base + 8])
                 increment = increment_base(data, base)
                 logger.debug("  Increment base by %s", increment)
-                base = base + increment
-                logger.debug("  There is useful EXIF-like data here (quality, comment, copyright), but we have no parser for it.")
+                base += increment
+                logger.debug(
+                    "  There is useful EXIF-like data here (quality, comment, copyright), but we have no parser for it.")
             else:
                 try:
                     increment = increment_base(data, base)
                     logger.debug("  Got 0x%X and 0x%X instead",
                                  ord_(data[base]),
-                                 ord_(data[base+1]))
+                                 ord_(data[base + 1]))
                 except:
                     logger.debug("  Unexpected/unhandled segment type or file content.")
                     return {}
                 else:
                     logger.debug("  Increment base by %s", increment)
-                    base = base + increment
+                    base += increment
         f.seek(base + 12)
-        if ord_(data[2+base]) == 0xFF and data[6+base:10+base] == b'Exif':
+        if ord_(data[2 + base]) == 0xFF and data[6 + base:10 + base] == b'Exif':
             # detected EXIF header
             offset = f.tell()
             endian = f.read(1)
             #HACK TEST:  endian = 'M'
-        elif ord_(data[2+base]) == 0xFF and data[6+base:10+base+1] == b'Ducky':
+        elif ord_(data[2 + base]) == 0xFF and data[6 + base:10 + base + 1] == b'Ducky':
             # detected Ducky header.
             logger.debug("EXIF-like header (normally 0xFF and code): 0x%X and %s",
-                         ord_(data[2+base]) , data[6+base:10+base+1])
+                         ord_(data[2 + base]), data[6 + base:10 + base + 1])
             offset = f.tell()
             endian = f.read(1)
-        elif ord_(data[2+base]) == 0xFF and data[6+base:10+base+1] == b'Adobe':
+        elif ord_(data[2 + base]) == 0xFF and data[6 + base:10 + base + 1] == b'Adobe':
             # detected APP14 (Adobe)
             logger.debug("EXIF-like header (normally 0xFF and code): 0x%X and %s",
-                         ord_(data[2+base]) , data[6+base:10+base+1])
+                         ord_(data[2 + base]), data[6 + base:10 + base + 1])
             offset = f.tell()
             endian = f.read(1)
         else:
             # no EXIF information
             logger.debug("No EXIF header expected data[2+base]==0xFF and data[6+base:10+base]===Exif (or Duck)")
             logger.debug("Did get 0x%X and %s",
-                         ord_(data[2+base]), data[6+base:10+base+1])
+                         ord_(data[2 + base]), data[6 + base:10 + base + 1])
             return {}
     else:
         # file format not recognized
@@ -183,9 +184,9 @@ def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug
     logger.debug("Endian format is %s (%s)", endian, {
         'I': 'Intel',
         'M': 'Motorola',
-        '\x01':'Adobe Ducky',
-        'd':'XMP/Adobe unknown'
-        }[endian])
+        '\x01': 'Adobe Ducky',
+        'd': 'XMP/Adobe unknown'
+    }[endian])
 
     hdr = ExifHeader(f, endian, offset, fake_exif, strict, debug, details)
     ifd_list = hdr.list_IFDs()
@@ -210,11 +211,11 @@ def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug
             intr_off = hdr.tags.get('EXIF SubIFD InteroperabilityOffset')
             if intr_off:
                 logger.debug('  EXIF Interoperability SubSubIFD at offset %d:',
-                          intr_off.values[0])
+                             intr_off.values[0])
                 hdr.dump_IFD(intr_off.values[0], 'EXIF Interoperability',
                              tag_dict=INTR_TAGS, stop_tag=stop_tag)
-        # GPS IFD
-        gps_off = hdr.tags.get(ifd_name+' GPSInfo')
+            # GPS IFD
+        gps_off = hdr.tags.get(ifd_name + ' GPSInfo')
         if gps_off:
             logger.debug(' GPS SubIFD at offset %d:', gps_off.values[0])
             hdr.dump_IFD(gps_off.values[0], 'GPS', tag_dict=GPS_TAGS, stop_tag=stop_tag)
diff --git a/exifread/classes.py b/exifread/classes.py
index f1acc8b..71953ed 100644
--- a/exifread/classes.py
+++ b/exifread/classes.py
@@ -1,4 +1,3 @@
-
 import logging
 import struct
 import re
@@ -13,6 +12,7 @@ class IfdTag:
     """
     Eases dealing with tags.
     """
+
     def __init__(self, printable, tag, field_type, values, field_offset,
                  field_length):
         # printable version of data
@@ -34,14 +34,14 @@ class IfdTag:
     def __repr__(self):
         try:
             s = '(0x%04X) %s=%s @ %d' % (self.tag,
-                                        FIELD_TYPES[self.field_type][2],
-                                        self.printable,
-                                        self.field_offset)
+                                         FIELD_TYPES[self.field_type][2],
+                                         self.printable,
+                                         self.field_offset)
         except:
             s = '(%s) %s=%s @ %s' % (str(self.tag),
-                                        FIELD_TYPES[self.field_type][2],
-                                        self.printable,
-                                        str(self.field_offset))
+                                     FIELD_TYPES[self.field_type][2],
+                                     self.printable,
+                                     str(self.field_offset))
         return s
 
 
@@ -49,6 +49,7 @@ class ExifHeader:
     """
     Handle an EXIF header.
     """
+
     def __init__(self, file, endian, offset, fake_exif, strict, debug=0, detailed=True):
         self.file = file
         self.endian = endian
@@ -59,7 +60,6 @@ class ExifHeader:
         self.detailed = detailed
         self.tags = {}
 
-
     def s2n(self, offset, length, signed=0):
         """
         Convert slice to integer, based on sign and endian flags.
@@ -75,14 +75,13 @@ class ExifHeader:
             val = s2n_intel(slice)
         else:
             val = s2n_motorola(slice)
-        # Sign extension ?
+            # Sign extension ?
         if signed:
-            msb = 1 << (8*length-1)
+            msb = 1 << (8 * length - 1)
             if val & msb:
-                val = val-(msb << 1)
+                val = val - (msb << 1)
         return val
 
-
     def n2s(self, offset, length):
         """Convert offset to string."""
         s = ''
@@ -94,22 +93,19 @@ class ExifHeader:
             offset = offset >> 8
         return s
 
-
     def first_IFD(self):
         """Return first IFD."""
         return self.s2n(4, 4)
 
-
     def next_IFD(self, ifd):
         """Return the pointer to next IFD."""
         entries = self.s2n(ifd, 2)
-        next_ifd = self.s2n(ifd+2+12*entries, 4)
+        next_ifd = self.s2n(ifd + 2 + 12 * entries, 4)
         if next_ifd == ifd:
             return 0
         else:
             return next_ifd
 
-
     def list_IFDs(self):
         """Return the list of IFDs in the header."""
         i = self.first_IFD()
@@ -119,7 +115,6 @@ class ExifHeader:
             i = self.next_IFD(i)
         return ifds
 
-
     def dump_IFD(self, ifd, ifd_name, tag_dict=EXIF_TAGS, relative=0, stop_tag=DEFAULT_STOP_TAG):
         """Return a list of entries in the given IFD."""
         entries = self.s2n(ifd, 2)
@@ -198,7 +193,7 @@ class ExifHeader:
                             if field_type in (5, 10):
                                 # a ratio
                                 value = Ratio(self.s2n(offset, 4, signed),
-                                                self.s2n(offset + 4, 4, signed))
+                                              self.s2n(offset + 4, 4, signed))
                             else:
                                 value = self.s2n(offset, typelen, signed)
                             values.append(value)
@@ -211,14 +206,14 @@ class ExifHeader:
                             value = self.s2n(offset, typelen, signed)
                             values.append(value)
                             offset = offset + typelen
-                    #else :
-                    #    print "Warning: dropping large tag:", tag, tag_name
+                            #else :
+                            #    print "Warning: dropping large tag:", tag, tag_name
 
                 # now 'values' is either a string or an array
                 if count == 1 and field_type != 2:
                     printable = str(values[0])
-                elif count > 50 and len(values) > 20 :
-                    printable = str( values[0:20] )[0:-1] + ", ... ]"
+                elif count > 50 and len(values) > 20:
+                    printable = str(values[0:20])[0:-1] + ", ... ]"
                 else:
                     printable = str(values)
 
@@ -236,15 +231,14 @@ class ExifHeader:
                                 printable += tag_entry[1].get(i, repr(i))
 
                 self.tags[ifd_name + ' ' + tag_name] = IfdTag(printable, tag,
-                                                            field_type,
-                                                            values, field_offset,
-                                                            count * typelen)
+                                                              field_type,
+                                                              values, field_offset,
+                                                              count * typelen)
                 logger.debug(" %s: %s", tag_name, repr(self.tags[ifd_name + ' ' + tag_name]))
 
             if tag_name == stop_tag:
                 break
 
-
     def extract_tiff_thumbnail(self, thumb_ifd):
         """
         Extract uncompressed TIFF thumbnail.
@@ -262,35 +256,35 @@ class ExifHeader:
             tiff = 'MM\x00*\x00\x00\x00\x08'
         else:
             tiff = 'II*\x00\x08\x00\x00\x00'
-        # ... plus thumbnail IFD data plus a null "next IFD" pointer
+            # ... plus thumbnail IFD data plus a null "next IFD" pointer
         self.file.seek(self.offset + thumb_ifd)
-        tiff += self.file.read(entries*12+2) + '\x00\x00\x00\x00'
+        tiff += self.file.read(entries * 12 + 2) + '\x00\x00\x00\x00'
 
         # fix up large value offset pointers into data area
         for i in range(entries):
             entry = thumb_ifd + 2 + 12 * i
             tag = self.s2n(entry, 2)
-            field_type = self.s2n(entry+2, 2)
+            field_type = self.s2n(entry + 2, 2)
             typelen = FIELD_TYPES[field_type][0]
-            count = self.s2n(entry+4, 4)
-            oldoff = self.s2n(entry+8, 4)
+            count = self.s2n(entry + 4, 4)
+            oldoff = self.s2n(entry + 8, 4)
             # start of the 4-byte pointer area in entry
             ptr = i * 12 + 18
             # remember strip offsets location
             if tag == 0x0111:
                 strip_off = ptr
                 strip_len = count * typelen
-            # is it in the data area?
+                # is it in the data area?
             if count * typelen > 4:
                 # update offset pointer (nasty "strings are immutable" crap)
                 # should be able to say "tiff[ptr:ptr+4]=newoff"
                 newoff = len(tiff)
-                tiff = tiff[:ptr] + self.n2s(newoff, 4) + tiff[ptr+4:]
+                tiff = tiff[:ptr] + self.n2s(newoff, 4) + tiff[ptr + 4:]
                 # remember strip offsets location
                 if tag == 0x0111:
                     strip_off = newoff
                     strip_len = 4
-                # get original data and store it
+                    # get original data and store it
                 self.file.seek(self.offset + oldoff)
                 tiff += self.file.read(count * typelen)
 
@@ -308,7 +302,6 @@ class ExifHeader:
 
         self.tags['TIFFThumbnail'] = tiff
 
-
     def extract_jpeg_thumbnail(self):
         """
         Extract JPEG thumbnail.
@@ -329,7 +322,6 @@ class ExifHeader:
                 self.file.seek(self.offset + thumb_offset.values[0])
                 self.tags['JPEGThumbnail'] = self.file.read(thumb_offset.field_length)
 
-
     def decode_maker_note(self):
         """
         Decode all the camera-specific MakerNote formats
@@ -371,15 +363,15 @@ class ExifHeader:
         if 'NIKON' in make:
             if note.values[0:7] == [78, 105, 107, 111, 110, 0, 1]:
                 logger.debug("Looks like a type 1 Nikon MakerNote.")
-                self.dump_IFD(note.field_offset+8, 'MakerNote',
+                self.dump_IFD(note.field_offset + 8, 'MakerNote',
                               tag_dict=makernote.NIKON_OLD)
             elif note.values[0:7] == [78, 105, 107, 111, 110, 0, 2]:
                 if self.debug:
                     logger.debug("Looks like a labeled type 2 Nikon MakerNote")
                 if note.values[12:14] != [0, 42] and note.values[12:14] != [42, 0]:
                     raise ValueError("Missing marker tag '42' in MakerNote.")
-                # skip the Makernote label and the TIFF header
-                self.dump_IFD(note.field_offset+10+8, 'MakerNote',
+                    # skip the Makernote label and the TIFF header
+                self.dump_IFD(note.field_offset + 10 + 8, 'MakerNote',
                               tag_dict=makernote.NIKON_NEW, relative=1)
             else:
                 # E99x or D1
@@ -390,7 +382,7 @@ class ExifHeader:
 
         # Olympus
         if make.startswith('OLYMPUS'):
-            self.dump_IFD(note.field_offset+8, 'MakerNote',
+            self.dump_IFD(note.field_offset + 8, 'MakerNote',
                           tag_dict=makernote.OLYMPUS)
             # TODO
             #for i in (('MakerNote Tag 0x2020', makernote.OLYMPUS_TAG_0x2020),):
@@ -440,12 +432,10 @@ class ExifHeader:
                 del self.tags[makernote.canon.CAMERA_INFO_TAG_NAME]
             return
 
-
     def olympus_decode_tag(self, value, mn_tags):
         """ TODO Decode Olympus MakerNote tag based on offset within tag."""
         pass
 
-
     def canon_decode_tag(self, value, mn_tags):
         """
         Decode Canon MakerNote tag based on offset within tag.
@@ -463,7 +453,7 @@ class ExifHeader:
                 logger.debug(" %s %s %s", i, name, hex(value[i]))
             except TypeError:
                 logger.debug(" %s %s %s", i, name, value[i])
-            
+
             # it's not a real IFD Tag but we fake one to make everybody
             # happy. this will have a "proprietary" type
             self.tags['MakerNote ' + name] = IfdTag(str(val), None, 0, None,
@@ -478,7 +468,7 @@ class ExifHeader:
 
         camera_info_tags = None
         for (model_name_re, tag_desc) in \
-              makernote.canon.CAMERA_INFO_MODEL_MAP.items():
+            makernote.canon.CAMERA_INFO_MODEL_MAP.items():
             if re.search(model_name_re, model):
                 camera_info_tags = tag_desc
                 break
@@ -498,7 +488,7 @@ class ExifHeader:
             tag_size = struct.calcsize(tag_format)
             if len(camera_info) < offset + tag_size:
                 continue
-            packed_tag_value = camera_info[offset:offset+tag_size]
+            packed_tag_value = camera_info[offset:offset + tag_size]
             tag_value = struct.unpack(tag_format, packed_tag_value)[0]
 
             tag_name = tag[0]
diff --git a/exifread/tags/exif.py b/exifread/tags/exif.py
index 989a890..51759f6 100644
--- a/exifread/tags/exif.py
+++ b/exifread/tags/exif.py
@@ -221,7 +221,7 @@ EXIF_TAGS = {
     # used by Windows Explorer
     0x9C9B: ('XPTitle', ),
     0x9C9C: ('XPComment', ),
-    0x9C9D: ('XPAuthor', ),  #(ignored by Windows Explorer if Artist exists)
+    0x9C9D: ('XPAuthor', ),  # (ignored by Windows Explorer if Artist exists)
     0x9C9E: ('XPKeywords', ),
     0x9C9F: ('XPSubject', ),
     0xA000: ('FlashPixVersion', make_string),
diff --git a/exifread/tags/makernote.py b/exifread/tags/makernote.py
index a725407..7810359 100644
--- a/exifread/tags/makernote.py
+++ b/exifread/tags/makernote.py
@@ -16,7 +16,7 @@ def nikon_ev_bias(seq):
     reading the Nikon MakerNote.
     http://tomtia.plala.jp/DigitalCamera/MakerNote/index.asp
     """
-    if len( seq ) < 4 :
+    if len(seq) < 4:
         return ''
     if seq == [252, 1, 6, 0]:
         return "-2/3 EV"
@@ -32,7 +32,7 @@ def nikon_ev_bias(seq):
         return "+1/2 EV"
     if seq == [4, 1, 6, 0]:
         return "+2/3 EV"
-    # Handle combinations not in the table.
+        # Handle combinations not in the table.
     a = seq[0]
     # Causes headaches for the +/- logic, so special case it.
     if a == 0:
@@ -48,7 +48,7 @@ def nikon_ev_bias(seq):
     if whole != 0:
         ret_str = ret_str + str(whole) + " "
     if a == 0:
-        ret_str = ret_str + "EV"
+        ret_str += "EV"
     else:
         r = Ratio(a, step)
         ret_str = ret_str + r.__repr__() + " EV"
@@ -56,7 +56,7 @@ def nikon_ev_bias(seq):
 
 # Nikon E99x MakerNote Tags
 NIKON_NEW = {
-    0x0001: ('MakernoteVersion', make_string),  # Sometimes binary
+    0x0001: ('MakernoteVersion', make_string), # Sometimes binary
     0x0002: ('ISOSetting', make_string),
     0x0003: ('ColorMode', ),
     0x0004: ('Quality', ),
@@ -96,31 +96,34 @@ NIKON_NEW = {
     0x0084: ('LensMinMaxFocalMaxAperture', ),
     0x0085: ('ManualFocusDistance', ),
     0x0086: ('DigitalZoomFactor', ),
-    0x0087: ('FlashMode',
-             {0x00: 'Did Not Fire',
-              0x01: 'Fired, Manual',
-              0x07: 'Fired, External',
-              0x08: 'Fired, Commander Mode ',
-              0x09: 'Fired, TTL Mode'}),
-    0x0088: ('AFFocusPosition',
-             {0x0000: 'Center',
-              0x0100: 'Top',
-              0x0200: 'Bottom',
-              0x0300: 'Left',
-              0x0400: 'Right'}),
-    0x0089: ('BracketingMode',
-             {0x00: 'Single frame, no bracketing',
-              0x01: 'Continuous, no bracketing',
-              0x02: 'Timer, no bracketing',
-              0x10: 'Single frame, exposure bracketing',
-              0x11: 'Continuous, exposure bracketing',
-              0x12: 'Timer, exposure bracketing',
-              0x40: 'Single frame, white balance bracketing',
-              0x41: 'Continuous, white balance bracketing',
-              0x42: 'Timer, white balance bracketing'}),
+    0x0087: ('FlashMode', {
+        0x00: 'Did Not Fire',
+        0x01: 'Fired, Manual',
+        0x07: 'Fired, External',
+        0x08: 'Fired, Commander Mode ',
+        0x09: 'Fired, TTL Mode',
+    }),
+    0x0088: ('AFFocusPosition', {
+        0x0000: 'Center',
+        0x0100: 'Top',
+        0x0200: 'Bottom',
+        0x0300: 'Left',
+        0x0400: 'Right',
+    }),
+    0x0089: ('BracketingMode', {
+        0x00: 'Single frame, no bracketing',
+        0x01: 'Continuous, no bracketing',
+        0x02: 'Timer, no bracketing',
+        0x10: 'Single frame, exposure bracketing',
+        0x11: 'Continuous, exposure bracketing',
+        0x12: 'Timer, exposure bracketing',
+        0x40: 'Single frame, white balance bracketing',
+        0x41: 'Continuous, white balance bracketing',
+        0x42: 'Timer, white balance bracketing'
+    }),
     0x008A: ('AutoBracketRelease', ),
     0x008B: ('LensFStops', ),
-    0x008C: ('NEFCurve1', ),  # ExifTool calls this 'ContrastCurve'
+    0x008C: ('NEFCurve1', ), # ExifTool calls this 'ContrastCurve'
     0x008D: ('ColorMode', ),
     0x008F: ('SceneMode', ),
     0x0090: ('LightingType', ),
@@ -128,15 +131,16 @@ NIKON_NEW = {
     0x0092: ('HueAdjustment', ),
     # ExifTool calls this 'NEFCompression', should be 1-4
     0x0093: ('Compression', ),
-    0x0094: ('Saturation',
-             {-3: 'B&W',
-              -2: '-2',
-              -1: '-1',
-              0: '0',
-              1: '1',
-              2: '2'}),
+    0x0094: ('Saturation', {
+        -3: 'B&W',
+        -2: '-2',
+        -1: '-1',
+        0: '0',
+        1: '1',
+        2: '2',
+    }),
     0x0095: ('NoiseReduction', ),
-    0x0096: ('NEFCurve2', ),  # ExifTool calls this 'LinearizationTable'
+    0x0096: ('NEFCurve2', ), # ExifTool calls this 'LinearizationTable'
     0x0097: ('ColorBalance', ), # First 4 bytes are a version number in ASCII
     0x0098: ('LensData', ), # First 4 bytes are a version number in ASCII
     0x0099: ('RawImageCenter', ),
@@ -157,49 +161,51 @@ NIKON_NEW = {
     0x00AA: ('Saturation', ),
     0x00AB: ('DigitalVariProgram', ),
     0x00AC: ('ImageStabilization', ),
-    0x00AD: ('Responsive AF', ),  # 'AFResponse'
+    0x00AD: ('Responsive AF', ), # 'AFResponse'
     0x00B0: ('MultiExposure', ),
     0x00B1: ('HighISONoiseReduction', ),
     0x00B7: ('AFInfo', ),
     0x00B8: ('FileInfo', ),
     # 00B9: unknown
     0x0100: ('DigitalICE', ),
-    0x0103: ('PreviewCompression',
-             {1: 'Uncompressed',
-              2: 'CCITT 1D',
-              3: 'T4/Group 3 Fax',
-              4: 'T6/Group 4 Fax',
-              5: 'LZW',
-              6: 'JPEG (old-style)',
-              7: 'JPEG',
-              8: 'Adobe Deflate',
-              9: 'JBIG B&W',
-              10: 'JBIG Color',
-              32766: 'Next',
-              32769: 'Epson ERF Compressed',
-              32771: 'CCIRLEW',
-              32773: 'PackBits',
-              32809: 'Thunderscan',
-              32895: 'IT8CTPAD',
-              32896: 'IT8LW',
-              32897: 'IT8MP',
-              32898: 'IT8BL',
-              32908: 'PixarFilm',
-              32909: 'PixarLog',
-              32946: 'Deflate',
-              32947: 'DCS',
-              34661: 'JBIG',
-              34676: 'SGILog',
-              34677: 'SGILog24',
-              34712: 'JPEG 2000',
-              34713: 'Nikon NEF Compressed',
-              65000: 'Kodak DCR Compressed',
-              65535: 'Pentax PEF Compressed',}),
+    0x0103: ('PreviewCompression', {
+        1: 'Uncompressed',
+        2: 'CCITT 1D',
+        3: 'T4/Group 3 Fax',
+        4: 'T6/Group 4 Fax',
+        5: 'LZW',
+        6: 'JPEG (old-style)',
+        7: 'JPEG',
+        8: 'Adobe Deflate',
+        9: 'JBIG B&W',
+        10: 'JBIG Color',
+        32766: 'Next',
+        32769: 'Epson ERF Compressed',
+        32771: 'CCIRLEW',
+        32773: 'PackBits',
+        32809: 'Thunderscan',
+        32895: 'IT8CTPAD',
+        32896: 'IT8LW',
+        32897: 'IT8MP',
+        32898: 'IT8BL',
+        32908: 'PixarFilm',
+        32909: 'PixarLog',
+        32946: 'Deflate',
+        32947: 'DCS',
+        34661: 'JBIG',
+        34676: 'SGILog',
+        34677: 'SGILog24',
+        34712: 'JPEG 2000',
+        34713: 'Nikon NEF Compressed',
+        65000: 'Kodak DCR Compressed',
+        65535: 'Pentax PEF Compressed',
+    }),
     0x0201: ('PreviewImageStart', ),
     0x0202: ('PreviewImageLength', ),
-    0x0213: ('PreviewYCbCrPositioning',
-             {1: 'Centered',
-              2: 'Co-sited'}),
+    0x0213: ('PreviewYCbCrPositioning', {
+        1: 'Centered',
+        2: 'Co-sited',
+    }),
     0x0E09: ('NikonCaptureVersion', ),
     0x0E0E: ('NikonCaptureOffsets', ),
     0x0E10: ('NikonScan', ),
@@ -207,35 +213,40 @@ NIKON_NEW = {
 }
 
 NIKON_OLD = {
-    0x0003: ('Quality',
-             {1: 'VGA Basic',
-              2: 'VGA Normal',
-              3: 'VGA Fine',
-              4: 'SXGA Basic',
-              5: 'SXGA Normal',
-              6: 'SXGA Fine'}),
-    0x0004: ('ColorMode',
-             {1: 'Color',
-              2: 'Monochrome'}),
-    0x0005: ('ImageAdjustment',
-             {0: 'Normal',
-              1: 'Bright+',
-              2: 'Bright-',
-              3: 'Contrast+',
-              4: 'Contrast-'}),
-    0x0006: ('CCDSpeed',
-             {0: 'ISO 80',
-              2: 'ISO 160',
-              4: 'ISO 320',
-              5: 'ISO 100'}),
-    0x0007: ('WhiteBalance',
-             {0: 'Auto',
-              1: 'Preset',
-              2: 'Daylight',
-              3: 'Incandescent',
-              4: 'Fluorescent',
-              5: 'Cloudy',
-              6: 'Speed Light'}),
+    0x0003: ('Quality', {
+        1: 'VGA Basic',
+        2: 'VGA Normal',
+        3: 'VGA Fine',
+        4: 'SXGA Basic',
+        5: 'SXGA Normal',
+        6: 'SXGA Fine',
+    }),
+    0x0004: ('ColorMode', {
+        1: 'Color',
+        2: 'Monochrome',
+    }),
+    0x0005: ('ImageAdjustment', {
+        0: 'Normal',
+        1: 'Bright+',
+        2: 'Bright-',
+        3: 'Contrast+',
+        4: 'Contrast-',
+    }),
+    0x0006: ('CCDSpeed', {
+        0: 'ISO 80',
+        2: 'ISO 160',
+        4: 'ISO 320',
+        5: 'ISO 100',
+    }),
+    0x0007: ('WhiteBalance', {
+        0: 'Auto',
+        1: 'Preset',
+        2: 'Daylight',
+        3: 'Incandescent',
+        4: 'Fluorescent',
+        5: 'Cloudy',
+        6: 'Speed Light',
+    }),
 }
 
 
@@ -245,33 +256,39 @@ def olympus_special_mode(v):
         0: 'Normal',
         1: 'Unknown',
         2: 'Fast',
-        3: 'Panorama'}
+        3: 'Panorama',
+    }
     mode2 = {
         0: 'Non-panoramic',
         1: 'Left to right',
         2: 'Right to left',
         3: 'Bottom to top',
-        4: 'Top to bottom'}
+        4: 'Top to bottom',
+    }
     if v[0] not in mode1 or v[2] not in mode2:
         return v
     return '%s - sequence %d - %s' % (mode1[v[0]], v[1], mode2[v[2]])
 
+
 OLYMPUS = {
     # ah HAH! those sneeeeeaky bastids! this is how they get past the fact
     # that a JPEG thumbnail is not allowed in an uncompressed TIFF file
     0x0100: ('JPEGThumbnail', ),
     0x0200: ('SpecialMode', olympus_special_mode),
-    0x0201: ('JPEGQual',
-             {1: 'SQ',
-              2: 'HQ',
-              3: 'SHQ'}),
-    0x0202: ('Macro',
-             {0: 'Normal',
-             1: 'Macro',
-             2: 'SuperMacro'}),
-    0x0203: ('BWMode',
-             {0: 'Off',
-             1: 'On'}),
+    0x0201: ('JPEGQual', {
+        1: 'SQ',
+        2: 'HQ',
+        3: 'SHQ',
+    }),
+    0x0202: ('Macro', {
+        0: 'Normal',
+        1: 'Macro',
+        2: 'SuperMacro'
+    }),
+    0x0203: ('BWMode', {
+        0: 'Off',
+        1: 'On'
+    }),
     0x0204: ('DigitalZoom', ),
     0x0205: ('FocalPlaneDiagonal', ),
     0x0206: ('LensDistortionParams', ),
@@ -286,33 +303,38 @@ OLYMPUS = {
     0x1002: ('ApertureValue', ),
     0x1003: ('BrightnessValue', ),
     0x1004: ('FlashMode', ),
-    0x1004: ('FlashMode',
-       {2: 'On',
-        3: 'Off'}),
-    0x1005: ('FlashDevice',
-       {0: 'None',
+    0x1004: ('FlashMode', {
+        2: 'On',
+        3: 'Off'
+    }),
+    0x1005: ('FlashDevice', {
+        0: 'None',
         1: 'Internal',
         4: 'External',
-        5: 'Internal + External'}),
+        5: 'Internal + External'
+    }),
     0x1006: ('ExposureCompensation', ),
     0x1007: ('SensorTemperature', ),
     0x1008: ('LensTemperature', ),
-    0x100b: ('FocusMode',
-       {0: 'Auto',
-        1: 'Manual'}),
+    0x100b: ('FocusMode', {
+        0: 'Auto',
+        1: 'Manual'
+    }),
     0x1017: ('RedBalance', ),
     0x1018: ('BlueBalance', ),
     0x101a: ('SerialNumber', ),
     0x1023: ('FlashExposureComp', ),
-    0x1026: ('ExternalFlashBounce',
-       {0: 'No',
-        1: 'Yes'}),
+    0x1026: ('ExternalFlashBounce', {
+        0: 'No',
+        1: 'Yes'
+    }),
     0x1027: ('ExternalFlashZoom', ),
     0x1028: ('ExternalFlashMode', ),
-    0x1029: ('Contrast  int16u',
-       {0: 'High',
+    0x1029: ('Contrast  int16u', {
+        0: 'High',
         1: 'Normal',
-        2: 'Low'}),
+        2: 'Low'
+    }),
     0x102a: ('SharpnessFactor', ),
     0x102b: ('ColorControl', ),
     0x102c: ('ValidBits', ),
@@ -320,17 +342,20 @@ OLYMPUS = {
     0x102e: ('OlympusImageWidth', ),
     0x102f: ('OlympusImageHeight', ),
     0x1034: ('CompressionRatio', ),
-    0x1035: ('PreviewImageValid',
-       {0: 'No',
-        1: 'Yes'}),
+    0x1035: ('PreviewImageValid', {
+        0: 'No',
+        1: 'Yes'
+    }),
     0x1036: ('PreviewImageStart', ),
     0x1037: ('PreviewImageLength', ),
-    0x1039: ('CCDScanMode',
-       {0: 'Interlaced',
-        1: 'Progressive'}),
-    0x103a: ('NoiseReduction',
-       {0: 'Off',
-        1: 'On'}),
+    0x1039: ('CCDScanMode', {
+        0: 'Interlaced',
+        1: 'Progressive'
+    }),
+    0x103a: ('NoiseReduction', {
+        0: 'Off',
+        1: 'On'
+    }),
     0x103b: ('InfinityLensStep', ),
     0x103c: ('NearLensStep', ),
 
@@ -346,272 +371,315 @@ OLYMPUS = {
 
 # 0x2020 CameraSettings
 OLYMPUS_TAG_0x2020 = {
-    0x0100: ('PreviewImageValid',
-             {0: 'No',
-              1: 'Yes'}),
+    0x0100: ('PreviewImageValid', {
+        0: 'No',
+        1: 'Yes'
+    }),
     0x0101: ('PreviewImageStart', ),
     0x0102: ('PreviewImageLength', ),
-    0x0200: ('ExposureMode',
-             {1: 'Manual',
-              2: 'Program',
-              3: 'Aperture-priority AE',
-              4: 'Shutter speed priority AE',
-              5: 'Program-shift'}),
-    0x0201: ('AELock',
-             {0: 'Off',
-              1: 'On'}),
-    0x0202: ('MeteringMode',
-             {2: 'Center Weighted',
-              3: 'Spot',
-              5: 'ESP',
-              261: 'Pattern+AF',
-              515: 'Spot+Highlight control',
-              1027: 'Spot+Shadow control'}),
-    0x0300: ('MacroMode',
-             {0: 'Off',
-              1: 'On'}),
-    0x0301: ('FocusMode',
-             {0: 'Single AF',
-              1: 'Sequential shooting AF',
-              2: 'Continuous AF',
-              3: 'Multi AF',
-              10: 'MF'}),
-    0x0302: ('FocusProcess',
-             {0: 'AF Not Used',
-              1: 'AF Used'}),
-    0x0303: ('AFSearch',
-             {0: 'Not Ready',
-              1: 'Ready'}),
+    0x0200: ('ExposureMode', {
+        1: 'Manual',
+        2: 'Program',
+        3: 'Aperture-priority AE',
+        4: 'Shutter speed priority AE',
+        5: 'Program-shift'
+    }),
+    0x0201: ('AELock', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x0202: ('MeteringMode', {
+        2: 'Center Weighted',
+        3: 'Spot',
+        5: 'ESP',
+        261: 'Pattern+AF',
+        515: 'Spot+Highlight control',
+        1027: 'Spot+Shadow control'
+    }),
+    0x0300: ('MacroMode', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x0301: ('FocusMode', {
+        0: 'Single AF',
+        1: 'Sequential shooting AF',
+        2: 'Continuous AF',
+        3: 'Multi AF',
+        10: 'MF'
+    }),
+    0x0302: ('FocusProcess', {
+        0: 'AF Not Used',
+        1: 'AF Used'
+    }),
+    0x0303: ('AFSearch', {
+        0: 'Not Ready',
+        1: 'Ready'
+    }),
     0x0304: ('AFAreas', ),
     0x0401: ('FlashExposureCompensation', ),
-    0x0500: ('WhiteBalance2',
-             {0: 'Auto',
-             16: '7500K (Fine Weather with Shade)',
-             17: '6000K (Cloudy)',
-             18: '5300K (Fine Weather)',
-             20: '3000K (Tungsten light)',
-             21: '3600K (Tungsten light-like)',
-             33: '6600K (Daylight fluorescent)',
-             34: '4500K (Neutral white fluorescent)',
-             35: '4000K (Cool white fluorescent)',
-             48: '3600K (Tungsten light-like)',
-             256: 'Custom WB 1',
-             257: 'Custom WB 2',
-             258: 'Custom WB 3',
-             259: 'Custom WB 4',
-             512: 'Custom WB 5400K',
-             513: 'Custom WB 2900K',
-             514: 'Custom WB 8000K', }),
+    0x0500: ('WhiteBalance2', {
+        0: 'Auto',
+        16: '7500K (Fine Weather with Shade)',
+        17: '6000K (Cloudy)',
+        18: '5300K (Fine Weather)',
+        20: '3000K (Tungsten light)',
+        21: '3600K (Tungsten light-like)',
+        33: '6600K (Daylight fluorescent)',
+        34: '4500K (Neutral white fluorescent)',
+        35: '4000K (Cool white fluorescent)',
+        48: '3600K (Tungsten light-like)',
+        256: 'Custom WB 1',
+        257: 'Custom WB 2',
+        258: 'Custom WB 3',
+        259: 'Custom WB 4',
+        512: 'Custom WB 5400K',
+        513: 'Custom WB 2900K',
+        514: 'Custom WB 8000K',
+    }),
     0x0501: ('WhiteBalanceTemperature', ),
     0x0502: ('WhiteBalanceBracket', ),
     0x0503: ('CustomSaturation', ), # (3 numbers: 1. CS Value, 2. Min, 3. Max)
-    0x0504: ('ModifiedSaturation',
-             {0: 'Off',
-              1: 'CM1 (Red Enhance)',
-              2: 'CM2 (Green Enhance)',
-              3: 'CM3 (Blue Enhance)',
-              4: 'CM4 (Skin Tones)'}),
+    0x0504: ('ModifiedSaturation', {
+        0: 'Off',
+        1: 'CM1 (Red Enhance)',
+        2: 'CM2 (Green Enhance)',
+        3: 'CM3 (Blue Enhance)',
+        4: 'CM4 (Skin Tones)',
+    }),
     0x0505: ('ContrastSetting', ), # (3 numbers: 1. Contrast, 2. Min, 3. Max)
     0x0506: ('SharpnessSetting', ), # (3 numbers: 1. Sharpness, 2. Min, 3. Max)
-    0x0507: ('ColorSpace',
-             {0: 'sRGB',
-              1: 'Adobe RGB',
-              2: 'Pro Photo RGB'}),
-    0x0509: ('SceneMode',
-             {0: 'Standard',
-              6: 'Auto',
-              7: 'Sport',
-              8: 'Portrait',
-              9: 'Landscape+Portrait',
-             10: 'Landscape',
-             11: 'Night scene',
-             13: 'Panorama',
-             16: 'Landscape+Portrait',
-             17: 'Night+Portrait',
-             19: 'Fireworks',
-             20: 'Sunset',
-             22: 'Macro',
-             25: 'Documents',
-             26: 'Museum',
-             28: 'Beach&Snow',
-             30: 'Candle',
-             35: 'Underwater Wide1',
-             36: 'Underwater Macro',
-             39: 'High Key',
-             40: 'Digital Image Stabilization',
-             44: 'Underwater Wide2',
-             45: 'Low Key',
-             46: 'Children',
-             48: 'Nature Macro'}),
-    0x050a: ('NoiseReduction',
-             {0: 'Off',
-              1: 'Noise Reduction',
-              2: 'Noise Filter',
-              3: 'Noise Reduction + Noise Filter',
-              4: 'Noise Filter (ISO Boost)',
-              5: 'Noise Reduction + Noise Filter (ISO Boost)'}),
-    0x050b: ('DistortionCorrection',
-             {0: 'Off',
-              1: 'On'}),
-    0x050c: ('ShadingCompensation',
-             {0: 'Off',
-              1: 'On'}),
+    0x0507: ('ColorSpace', {
+        0: 'sRGB',
+        1: 'Adobe RGB',
+        2: 'Pro Photo RGB'
+    }),
+    0x0509: ('SceneMode', {
+        0: 'Standard',
+        6: 'Auto',
+        7: 'Sport',
+        8: 'Portrait',
+        9: 'Landscape+Portrait',
+        10: 'Landscape',
+        11: 'Night scene',
+        13: 'Panorama',
+        16: 'Landscape+Portrait',
+        17: 'Night+Portrait',
+        19: 'Fireworks',
+        20: 'Sunset',
+        22: 'Macro',
+        25: 'Documents',
+        26: 'Museum',
+        28: 'Beach&Snow',
+        30: 'Candle',
+        35: 'Underwater Wide1',
+        36: 'Underwater Macro',
+        39: 'High Key',
+        40: 'Digital Image Stabilization',
+        44: 'Underwater Wide2',
+        45: 'Low Key',
+        46: 'Children',
+        48: 'Nature Macro',
+    }),
+    0x050a: ('NoiseReduction', {
+        0: 'Off',
+        1: 'Noise Reduction',
+        2: 'Noise Filter',
+        3: 'Noise Reduction + Noise Filter',
+        4: 'Noise Filter (ISO Boost)',
+        5: 'Noise Reduction + Noise Filter (ISO Boost)'
+    }),
+    0x050b: ('DistortionCorrection', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x050c: ('ShadingCompensation', {
+        0: 'Off',
+        1: 'On'
+    }),
     0x050d: ('CompressionFactor', ),
-    0x050f: ('Gradation',
-             {'-1 -1 1': 'Low Key',
-              '0 -1 1': 'Normal',
-              '1 -1 1': 'High Key'}),
-    0x0520: ('PictureMode',
-             {1: 'Vivid',
-              2: 'Natural',
-              3: 'Muted',
-              256: 'Monotone',
-              512: 'Sepia'}),
+    0x050f: ('Gradation', {
+        '-1 -1 1': 'Low Key',
+        '0 -1 1': 'Normal',
+        '1 -1 1': 'High Key'
+    }),
+    0x0520: ('PictureMode', {
+        1: 'Vivid',
+        2: 'Natural',
+        3: 'Muted',
+        256: 'Monotone',
+        512: 'Sepia'
+    }),
     0x0521: ('PictureModeSaturation', ),
     0x0522: ('PictureModeHue?', ),
     0x0523: ('PictureModeContrast', ),
     0x0524: ('PictureModeSharpness', ),
-    0x0525: ('PictureModeBWFilter',
-             {0: 'n/a',
-              1: 'Neutral',
-              2: 'Yellow',
-              3: 'Orange',
-              4: 'Red',
-              5: 'Green'}),
-    0x0526: ('PictureModeTone',
-             {0: 'n/a',
-              1: 'Neutral',
-              2: 'Sepia',
-              3: 'Blue',
-              4: 'Purple',
-              5: 'Green'}),
+    0x0525: ('PictureModeBWFilter', {
+        0: 'n/a',
+        1: 'Neutral',
+        2: 'Yellow',
+        3: 'Orange',
+        4: 'Red',
+        5: 'Green'
+    }),
+    0x0526: ('PictureModeTone', {
+        0: 'n/a',
+        1: 'Neutral',
+        2: 'Sepia',
+        3: 'Blue',
+        4: 'Purple',
+        5: 'Green'
+    }),
     0x0600: ('Sequence', ), # 2 or 3 numbers: 1. Mode, 2. Shot number, 3. Mode bits
     0x0601: ('PanoramaMode', ), # (2 numbers: 1. Mode, 2. Shot number)
-    0x0603: ('ImageQuality2',
-             {1: 'SQ',
-              2: 'HQ',
-              3: 'SHQ',
-              4: 'RAW'}),
+    0x0603: ('ImageQuality2', {
+        1: 'SQ',
+        2: 'HQ',
+        3: 'SHQ',
+        4: 'RAW',
+    }),
     0x0901: ('ManometerReading', ),
 }
 
 CASIO = {
-    0x0001: ('RecordingMode',
-             {1: 'Single Shutter',
-              2: 'Panorama',
-              3: 'Night Scene',
-              4: 'Portrait',
-              5: 'Landscape'}),
-    0x0002: ('Quality',
-             {1: 'Economy',
-              2: 'Normal',
-              3: 'Fine'}),
-    0x0003: ('FocusingMode',
-             {2: 'Macro',
-              3: 'Auto Focus',
-              4: 'Manual Focus',
-              5: 'Infinity'}),
-    0x0004: ('FlashMode',
-             {1: 'Auto',
-              2: 'On',
-              3: 'Off',
-              4: 'Red Eye Reduction'}),
-    0x0005: ('FlashIntensity',
-             {11: 'Weak',
-              13: 'Normal',
-              15: 'Strong'}),
+    0x0001: ('RecordingMode', {
+        1: 'Single Shutter',
+        2: 'Panorama',
+        3: 'Night Scene',
+        4: 'Portrait',
+        5: 'Landscape',
+    }),
+    0x0002: ('Quality', {
+        1: 'Economy',
+        2: 'Normal',
+        3: 'Fine'
+    }),
+    0x0003: ('FocusingMode', {
+        2: 'Macro',
+        3: 'Auto Focus',
+        4: 'Manual Focus',
+        5: 'Infinity'
+    }),
+    0x0004: ('FlashMode', {
+        1: 'Auto',
+        2: 'On',
+        3: 'Off',
+        4: 'Red Eye Reduction',
+    }),
+    0x0005: ('FlashIntensity', {
+        11: 'Weak',
+        13: 'Normal',
+        15: 'Strong'
+    }),
     0x0006: ('Object Distance', ),
-    0x0007: ('WhiteBalance',
-             {1: 'Auto',
-              2: 'Tungsten',
-              3: 'Daylight',
-              4: 'Fluorescent',
-              5: 'Shade',
-              129: 'Manual'}),
-    0x000B: ('Sharpness',
-             {0: 'Normal',
-              1: 'Soft',
-              2: 'Hard'}),
-    0x000C: ('Contrast',
-             {0: 'Normal',
-              1: 'Low',
-              2: 'High'}),
-    0x000D: ('Saturation',
-             {0: 'Normal',
-              1: 'Low',
-              2: 'High'}),
-    0x0014: ('CCDSpeed',
-             {64: 'Normal',
-              80: 'Normal',
-              100: 'High',
-              125: '+1.0',
-              244: '+3.0',
-              250: '+2.0'}),
+    0x0007: ('WhiteBalance', {
+        1: 'Auto',
+        2: 'Tungsten',
+        3: 'Daylight',
+        4: 'Fluorescent',
+        5: 'Shade',
+        129: 'Manual'
+    }),
+    0x000B: ('Sharpness', {
+        0: 'Normal',
+        1: 'Soft',
+        2: 'Hard',
+    }),
+    0x000C: ('Contrast', {
+        0: 'Normal',
+        1: 'Low',
+        2: 'High',
+    }),
+    0x000D: ('Saturation', {
+        0: 'Normal',
+        1: 'Low',
+        2: 'High',
+    }),
+    0x0014: ('CCDSpeed', {
+        64: 'Normal',
+        80: 'Normal',
+        100: 'High',
+        125: '+1.0',
+        244: '+3.0',
+        250: '+2.0'
+    }),
 }
 
 FUJIFILM = {
     0x0000: ('NoteVersion', make_string),
     0x1000: ('Quality', ),
-    0x1001: ('Sharpness',
-             {1: 'Soft',
-              2: 'Soft',
-              3: 'Normal',
-              4: 'Hard',
-              5: 'Hard'}),
-    0x1002: ('WhiteBalance',
-             {0: 'Auto',
-              256: 'Daylight',
-              512: 'Cloudy',
-              768: 'DaylightColor-Fluorescent',
-              769: 'DaywhiteColor-Fluorescent',
-              770: 'White-Fluorescent',
-              1024: 'Incandescent',
-              3840: 'Custom'}),
-    0x1003: ('Color',
-             {0: 'Normal',
-              256: 'High',
-              512: 'Low'}),
-    0x1004: ('Tone',
-             {0: 'Normal',
-              256: 'High',
-              512: 'Low'}),
-    0x1010: ('FlashMode',
-             {0: 'Auto',
-              1: 'On',
-              2: 'Off',
-              3: 'Red Eye Reduction'}),
+    0x1001: ('Sharpness', {
+        1: 'Soft',
+        2: 'Soft',
+        3: 'Normal',
+        4: 'Hard',
+        5: 'Hard'
+    }),
+    0x1002: ('WhiteBalance', {
+        0: 'Auto',
+        256: 'Daylight',
+        512: 'Cloudy',
+        768: 'DaylightColor-Fluorescent',
+        769: 'DaywhiteColor-Fluorescent',
+        770: 'White-Fluorescent',
+        1024: 'Incandescent',
+        3840: 'Custom'
+    }),
+    0x1003: ('Color', {
+        0: 'Normal',
+        256: 'High',
+        512: 'Low'
+    }),
+    0x1004: ('Tone', {
+        0: 'Normal',
+        256: 'High',
+        512: 'Low'
+    }),
+    0x1010: ('FlashMode', {
+        0: 'Auto',
+        1: 'On',
+        2: 'Off',
+        3: 'Red Eye Reduction'
+    }),
     0x1011: ('FlashStrength', ),
-    0x1020: ('Macro',
-             {0: 'Off',
-              1: 'On'}),
-    0x1021: ('FocusMode',
-             {0: 'Auto',
-              1: 'Manual'}),
-    0x1030: ('SlowSync',
-             {0: 'Off',
-              1: 'On'}),
-    0x1031: ('PictureMode',
-             {0: 'Auto',
-              1: 'Portrait',
-              2: 'Landscape',
-              4: 'Sports',
-              5: 'Night',
-              6: 'Program AE',
-              256: 'Aperture Priority AE',
-              512: 'Shutter Priority AE',
-              768: 'Manual Exposure'}),
-    0x1100: ('MotorOrBracket',
-             {0: 'Off',
-              1: 'On'}),
-    0x1300: ('BlurWarning',
-             {0: 'Off',
-              1: 'On'}),
-    0x1301: ('FocusWarning',
-             {0: 'Off',
-              1: 'On'}),
-    0x1302: ('AEWarning',
-             {0: 'Off',
-              1: 'On'}),
+    0x1020: ('Macro', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x1021: ('FocusMode', {
+        0: 'Auto',
+        1: 'Manual'
+    }),
+    0x1030: ('SlowSync', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x1031: ('PictureMode', {
+        0: 'Auto',
+        1: 'Portrait',
+        2: 'Landscape',
+        4: 'Sports',
+        5: 'Night',
+        6: 'Program AE',
+        256: 'Aperture Priority AE',
+        512: 'Shutter Priority AE',
+        768: 'Manual Exposure'
+    }),
+    0x1100: ('MotorOrBracket', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x1300: ('BlurWarning', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x1301: ('FocusWarning', {
+        0: 'Off',
+        1: 'On'
+    }),
+    0x1302: ('AEWarning', {
+        0: 'Off',
+        1: 'On'
+    }),
 }
 
 
diff --git a/exifread/tags/makernote_canon.py b/exifread/tags/makernote_canon.py
index f3b8f2c..6a4e563 100644
--- a/exifread/tags/makernote_canon.py
+++ b/exifread/tags/makernote_canon.py
@@ -367,12 +367,15 @@ FILE_INFO = {
     })
 }
 
+
 def add_one(value):
     return value + 1
 
+
 def subtract_one(value):
     return value - 1
 
+
 def convert_temp(value):
     return '%d C' % (value - 128)
 
diff --git a/exifread/utils.py b/exifread/utils.py
index 979f14c..5f66cfb 100644
--- a/exifread/utils.py
+++ b/exifread/utils.py
@@ -2,11 +2,13 @@
 Misc utilities.
 """
 
+
 def ord_(dta):
     if isinstance(dta, str):
         return ord(dta)
     return dta
 
+
 def make_string(seq):
     """
     Don't throw an exception when given an out of range character.
@@ -16,7 +18,7 @@ def make_string(seq):
         # Screen out non-printing characters
         if 32 <= c and c < 256:
             string += chr(c)
-    # If no printing chars
+        # If no printing chars
     if not string:
         return str(seq)
     return string
@@ -57,6 +59,7 @@ class Ratio:
     Ratio object that eventually will be able to reduce itself to lowest
     common denominator for printing.
     """
+
     def __init__(self, num, den):
         self.num = num
         self.den = den
diff --git a/setup.py b/setup.py
index 027d97c..b076fea 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ setup(
     version=exifread.__version__,
     author="Ianaré Sévi",
     author_email="ianare at gmail.com",
-    packages=["exifread", "exifread.tags"],
+    packages=find_packages(),
     scripts=["EXIF.py"],
     url="https://github.com/ianare/exif-py",
     license="BSD",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-exif.git



More information about the Python-modules-commits mailing list