Fix mypy update problems

This commit is contained in:
Matthias
2021-06-14 19:18:42 +02:00
parent 3f1d6d453c
commit 4ba7a2bbd2
3 changed files with 16 additions and 8 deletions

View File

@@ -58,6 +58,9 @@ class IResolver:
# Generate spec based on absolute path
# Pass object_name as first argument to have logging print a reasonable name.
spec = importlib.util.spec_from_file_location(object_name or "", str(module_path))
if not spec:
return iter([None])
module = importlib.util.module_from_spec(spec)
try:
spec.loader.exec_module(module) # type: ignore # importlib does not use typehints