mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Fix wiring multiple imports, issue #320
This commit is contained in:
parent
4579e35d33
commit
3c71ba4b2a
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
|
import importlib
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import sys
|
import sys
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
|
@ -289,11 +290,11 @@ def _resolve_injections(
|
||||||
|
|
||||||
def _fetch_modules(package):
|
def _fetch_modules(package):
|
||||||
modules = [package]
|
modules = [package]
|
||||||
for loader, module_name, is_pkg in pkgutil.walk_packages(
|
for module_info in pkgutil.walk_packages(
|
||||||
path=package.__path__,
|
path=package.__path__,
|
||||||
prefix=package.__name__ + '.',
|
prefix=package.__name__ + '.',
|
||||||
):
|
):
|
||||||
module = loader.find_module(module_name).load_module(module_name)
|
module = importlib.import_module(module_info.name)
|
||||||
modules.append(module)
|
modules.append(module)
|
||||||
return modules
|
return modules
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user