From c824a68dd8cba7ff567f54bf65d22d46438d326b Mon Sep 17 00:00:00 2001 From: Antoine Tenart Date: Wed, 27 Mar 2019 18:50:25 +0100 Subject: [PATCH] libmat2: reshape the dependencies list Invert the keys and values in DEPENDENCIES. It seems more natural to use the key as a key in check_dependencies(), and the value as the value. This also help in preparing for reworking the check_dependencies() helper. Signed-off-by: Antoine Tenart --- libmat2/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libmat2/__init__.py b/libmat2/__init__.py index be7067b..1d945d4 100644 --- a/libmat2/__init__.py +++ b/libmat2/__init__.py @@ -30,12 +30,12 @@ UNSUPPORTED_EXTENSIONS = { } DEPENDENCIES = { - 'cairo': 'Cairo', - 'gi': 'PyGobject', - 'gi.repository.GdkPixbuf': 'GdkPixbuf from PyGobject', - 'gi.repository.Poppler': 'Poppler from PyGobject', - 'gi.repository.GLib': 'GLib from PyGobject', - 'mutagen': 'Mutagen', + 'Cairo': 'cairo', + 'PyGobject': 'gi', + 'GdkPixbuf from PyGobject': 'gi.repository.GdkPixbuf', + 'Poppler from PyGobject': 'gi.repository.Poppler', + 'GLib from PyGobject': 'gi.repository.GLib', + 'Mutagen': 'mutagen', } @@ -46,11 +46,11 @@ def check_dependencies() -> Dict[str, bool]: ret['Ffmpeg'] = bool(video._get_ffmpeg_path()) for key, value in DEPENDENCIES.items(): - ret[value] = True + ret[key] = True try: - importlib.import_module(key) + importlib.import_module(value) except ImportError: # pragma: no cover - ret[value] = False # pragma: no cover + ret[key] = False # pragma: no cover return ret