14 lines
409 B
Python
14 lines
409 B
Python
import pkgutil
|
|
import importlib
|
|
ADAPTERS = {}
|
|
|
|
def load_adapters():
|
|
# Dynamically import adapters in this package that expose an Adapter class
|
|
for finder, name, ispkg in pkgutil.iter_modules(__path__):
|
|
if not ispkg:
|
|
module = importlib.import_module(f"{__name__}.{name}")
|
|
if hasattr(module, "Adapter"):
|
|
ADAPTERS[name] = module.Adapter()
|
|
|
|
load_adapters()
|