Skip to content

Commit 331a073

Browse files
authored
Merge pull request slgobinath#718 from deltragon/fix-module-detection
utility: fix module detection
2 parents b193551 + 65ee965 commit 331a073

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

safeeyes/utility.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,9 @@ def command_exist(command):
362362

363363

364364
def module_exist(module):
365-
"""Check wther the given Python module exists or not."""
366-
try:
367-
importlib.util.find_spec(module)
368-
return True
369-
except ImportError:
370-
return False
365+
"""Check whether the given Python module exists or not."""
366+
module_spec = importlib.util.find_spec(module)
367+
return module_spec is not None
371368

372369

373370
def merge_configs(new_config, old_config):

0 commit comments

Comments
 (0)