From 6ba3e3f20d7d52895bc44f9fc35b068cfce47133 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 25 Jul 2015 17:14:23 +0200 Subject: _MASSIVE_ pep8 revamp Thank you so much PyCharm --- libmat/exiftool.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'libmat/exiftool.py') diff --git a/libmat/exiftool.py b/libmat/exiftool.py index aa6849d..0e1fefd 100644 --- a/libmat/exiftool.py +++ b/libmat/exiftool.py @@ -1,5 +1,5 @@ -''' Care about images with help of the amazing (perl) library Exiftool. -''' +""" Care about images with help of the amazing (perl) library Exiftool. +""" import subprocess @@ -7,25 +7,24 @@ import parser class ExiftoolStripper(parser.GenericParser): - ''' A generic stripper class using exiftool as backend - ''' + """ A generic stripper class using exiftool as backend + """ def __init__(self, filename, parser, mime, backup, is_writable, **kwargs): super(ExiftoolStripper, self).__init__(filename, parser, mime, backup, is_writable, **kwargs) - self.allowed = set(['ExifTool Version Number', 'File Name', 'Directory', - 'File Size', 'File Modification Date/Time', 'File Access Date/Time', 'File Permissions', - 'File Type', 'File Type Extension', 'MIME Type', 'Image Width', 'Image Height', - 'Image Size', 'File Inode Change Date/Time', 'Megapixels']) + self.allowed = {'ExifTool Version Number', 'File Name', 'Directory', 'File Size', 'File Modification Date/Time', + 'File Access Date/Time', 'File Permissions', 'File Type', 'File Type Extension', 'MIME Type', + 'Image Width', 'Image Height', 'Image Size', 'File Inode Change Date/Time', 'Megapixels'} self._set_allowed() def _set_allowed(self): - ''' Virtual method. Set the allowed/harmless list of metadata - ''' + """ Virtual method. Set the allowed/harmless list of metadata + """ raise NotImplementedError def remove_all(self): - ''' Remove all metadata with help of exiftool - ''' + """ Remove all metadata with help of exiftool + """ try: if self.backup: self.create_backup_copy() @@ -38,16 +37,16 @@ class ExiftoolStripper(parser.GenericParser): return False def is_clean(self): - ''' Check if the file is clean with the help of exiftool - ''' + """ Check if the file is clean with the help of exiftool + """ return not self.get_meta() def get_meta(self): - ''' Return every harmful meta with help of exiftool. + """ Return every harmful meta with help of exiftool. Exiftool output looks like this: field name : value field name : value - ''' + """ output = subprocess.Popen(['exiftool', self.filename], stdout=subprocess.PIPE).communicate()[0] meta = {} @@ -59,9 +58,9 @@ class ExiftoolStripper(parser.GenericParser): class JpegStripper(ExiftoolStripper): - ''' Care about jpeg files with help + """ Care about jpeg files with help of exiftool - ''' + """ def _set_allowed(self): self.allowed.update(['JFIF Version', 'Resolution Unit', 'X Resolution', 'Y Resolution', 'Encoding Process', @@ -69,9 +68,9 @@ class JpegStripper(ExiftoolStripper): class PngStripper(ExiftoolStripper): - ''' Care about png files with help + """ Care about png files with help of exiftool - ''' + """ def _set_allowed(self): self.allowed.update(['Bit Depth', 'Color Type', 'Compression', 'Filter', 'Interlace', 'Palette', -- cgit v1.3