From b7848465cb833c36843921e32fa4903fe2bc73f4 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 6 Mar 2013 13:23:52 +0100 Subject: Some minor syntastic sugar --- MAT/archive.py | 11 +++++------ MAT/misc.py | 4 ++-- MAT/parser.py | 2 +- MAT/strippers.py | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'MAT') diff --git a/MAT/archive.py b/MAT/archive.py index 1dcddef..8127665 100644 --- a/MAT/archive.py +++ b/MAT/archive.py @@ -47,16 +47,15 @@ class ZipStripper(GenericArchiveStripper): Check if a ZipInfo object is clean of metadatas added by zip itself, independently of the corresponding file metadatas ''' - if fileinfo.comment != '': + if fileinfo.comment: return False - elif fileinfo.date_time != 0: + elif fileinfo.date_time: return False - elif fileinfo.create_system != 0: + elif fileinfo.create_system: return False - elif fileinfo.create_version != 0: + elif fileinfo.create_version: return False - else: - return True + return True def is_clean(self): ''' diff --git a/MAT/misc.py b/MAT/misc.py index 28ee892..582f34e 100644 --- a/MAT/misc.py +++ b/MAT/misc.py @@ -24,7 +24,7 @@ class TorrentStripper(parser.GenericParser): decoded = bencode.bdecode(f.read()) for key in self.fields: try: - if decoded[key] != '': + if decoded[key]: return False except KeyError: pass @@ -39,7 +39,7 @@ class TorrentStripper(parser.GenericParser): decoded = bencode.bdecode(f.read()) for key in self.fields: try: - if decoded[key] != '': + if decoded[key]: metadata[key] = decoded[key] except KeyError: pass diff --git a/MAT/parser.py b/MAT/parser.py index e5acbf8..d6b7faf 100644 --- a/MAT/parser.py +++ b/MAT/parser.py @@ -101,7 +101,7 @@ class GenericParser(object): ''' for field in fieldset: remove = self._should_remove(field) - if remove is True: + if remove: try: metadata[field.name] = field.value except: diff --git a/MAT/strippers.py b/MAT/strippers.py index 2bd17e1..bde58ca 100644 --- a/MAT/strippers.py +++ b/MAT/strippers.py @@ -60,7 +60,7 @@ try: import exiftool STRIPPERS['image/jpeg'] = exiftool.JpegStripper STRIPPERS['image/png'] = exiftool.PngStripper -except OSError: # if exiftool is not installed, use hachoir +except OSError: # if exiftool is not installed, use hachoir instead print('Unable to find exiftool: limited images support') STRIPPERS['image/jpeg'] = images.JpegStripper STRIPPERS['image/png'] = images.PngStripper -- cgit v1.3