1
0
Fork 0

Improve type annotation coverage

This commit is contained in:
jvoisin 2018-10-23 16:32:28 +02:00
parent f1a071d460
commit 9a81b3adfd
4 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ DEPENDENCIES = {
def check_dependencies() -> dict: def check_dependencies() -> Dict[str, bool]:
ret = collections.defaultdict(bool) # type: Dict[str, bool] ret = collections.defaultdict(bool) # type: Dict[str, bool]
ret['Exiftool'] = True if exiftool._get_exiftool_path() else False ret['Exiftool'] = True if exiftool._get_exiftool_path() else False

View File

@ -24,7 +24,7 @@ class ExiftoolParser(abstract.AbstractParser):
meta.pop(key, None) meta.pop(key, None)
return meta return meta
def _lightweight_cleanup(self): def _lightweight_cleanup(self) -> bool:
if os.path.exists(self.output_filename): if os.path.exists(self.output_filename):
try: try:
# exiftool can't force output to existing files # exiftool can't force output to existing files

View File

@ -125,7 +125,7 @@ class PDFParser(abstract.AbstractParser):
return True return True
@staticmethod @staticmethod
def __parse_metadata_field(data: str) -> dict: def __parse_metadata_field(data: str) -> Dict[str, str]:
metadata = {} metadata = {}
for (_, key, value) in re.findall(r"<(xmp|pdfx|pdf|xmpMM):(.+)>(.+)</\1:\2>", data, re.I): for (_, key, value) in re.findall(r"<(xmp|pdfx|pdf|xmpMM):(.+)>(.+)</\1:\2>", data, re.I):
metadata[key] = value metadata[key] = value

View File

@ -24,7 +24,7 @@ class AVIParser(exiftool.ExiftoolParser):
'SampleRate', 'AvgBytesPerSec', 'BitsPerSample', 'SampleRate', 'AvgBytesPerSec', 'BitsPerSample',
'Duration', 'ImageSize', 'Megapixels'} 'Duration', 'ImageSize', 'Megapixels'}
def remove_all(self): def remove_all(self) -> bool:
cmd = [_get_ffmpeg_path(), cmd = [_get_ffmpeg_path(),
'-i', self.filename, # input file '-i', self.filename, # input file
'-y', # overwrite existing output file '-y', # overwrite existing output file