Skip to content

Commit 9356ef8

Browse files
Fix package import verification (#101)
1 parent a390189 commit 9356ef8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/dipdup/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import types
88
from contextlib import asynccontextmanager
99
from logging import Logger
10-
from os.path import dirname
1110
from typing import Any, AsyncIterator, Dict, Iterator, List, Optional, Tuple, Type
1211

1312
import humps # type: ignore
@@ -24,10 +23,9 @@
2423

2524
def import_submodules(package: str) -> Dict[str, types.ModuleType]:
2625
"""Import all submodules of a module, recursively, including subpackages"""
27-
module = importlib.import_module(package)
2826
results = {}
29-
for _, name, is_pkg in pkgutil.walk_packages((dirname(module.__file__),)):
30-
full_name = module.__name__ + '.' + name
27+
for _, name, is_pkg in pkgutil.walk_packages((package,)):
28+
full_name = package + '.' + name
3129
results[full_name] = importlib.import_module(full_name)
3230
if is_pkg:
3331
results.update(import_submodules(full_name))

0 commit comments

Comments
 (0)