1
0
mirror of synced 2024-11-22 09:14:23 +01:00

Please mypy wrt. the last two commits

This commit is contained in:
jvoisin 2019-05-14 00:46:48 +02:00
parent f19f6ed8b6
commit aa52a5c91c

View File

@ -1,15 +1,15 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import collections
import enum import enum
import importlib import importlib
from typing import Dict, Optional from typing import Dict, Optional, Union
from . import exiftool, video from . import exiftool, video
# make pyflakes happy # make pyflakes happy
assert Dict assert Dict
assert Optional assert Optional
assert Union
# A set of extension that aren't supported, despite matching a supported mimetype # A set of extension that aren't supported, despite matching a supported mimetype
UNSUPPORTED_EXTENSIONS = { UNSUPPORTED_EXTENSIONS = {
@ -68,7 +68,7 @@ CMD_DEPENDENCIES = {
} }
def check_dependencies() -> Dict[str, Dict[str, bool]]: def check_dependencies() -> Dict[str, Dict[str, bool]]:
ret = collections.defaultdict(bool) # type: Dict[str, bool] ret = dict() # type: Dict[str, dict]
for key, value in DEPENDENCIES.items(): for key, value in DEPENDENCIES.items():
ret[key] = { ret[key] = {
@ -76,7 +76,7 @@ def check_dependencies() -> Dict[str, Dict[str, bool]]:
'required': value['required'], 'required': value['required'],
} }
try: try:
importlib.import_module(value['module']) importlib.import_module(value['module']) # type: ignore
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
ret[key]['found'] = False ret[key]['found'] = False
@ -86,7 +86,7 @@ def check_dependencies() -> Dict[str, Dict[str, bool]]:
'required': v['required'], 'required': v['required'],
} }
try: try:
v['cmd']() v['cmd']() # type: ignore
except RuntimeError: # pragma: no cover except RuntimeError: # pragma: no cover
ret[k]['found'] = False ret[k]['found'] = False