1
0

Compare commits

..

No commits in common. "919f949d17c8418e9a54cb8ef2c96e346e8ca9bb" and "0e21db41cbd7f8d59a5884903d41ab7bd7e2fe9c" have entirely different histories.

2 changed files with 13 additions and 25 deletions

View File

@ -57,8 +57,6 @@ __all__ = [
import importlib import importlib
import logging import logging
import inspect
import sys
from . import ( from . import (
data, data,
@ -68,30 +66,20 @@ from ._version import __version__
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
CURRENT_MODULE = sys.modules[__name__]
def load_backend(name: str) -> object | None: def load_backend(name: str) -> object | None:
try: try:
imported_module = importlib.import_module(f'{__name__}.{name}') return importlib.import_module(f'{__name__}.{name}')
CURRENT_MODULE.setmember(name, imported_module)
except Exception: except Exception:
logger.exception( logger.exception(
'Backend "%s" could not be imported. Are all module dependencies installed?', 'Backend %s could not be imported? Are all module dependencies installed?',
name, name,
) )
return None return None
# Import modules # Import modules
backend_modules = [ defi_kraken = load_backend('defi_kraken')
'defi_kraken', defi_kucoin = load_backend('defi_kucoin')
'defi_kucoin', investbank_nordnet = load_backend('investbank_nordnet')
'investbank_nordnet', defi_partisia_blockchain = load_backend('defi_partisia_blockchain')
'defi_partisia_blockchain',
]
for m in backend_modules:
load_backend(m)
del m
del backend_modules, CURRENT_MODULE