From 919f949d17c8418e9a54cb8ef2c96e346e8ca9bb Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Thu, 8 Aug 2024 17:56:14 +0200 Subject: [PATCH] Ruff --- fin_depo/__init__.py | 16 +++++++++++----- setup.py | 14 +++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/fin_depo/__init__.py b/fin_depo/__init__.py index 42023b7..d5174fc 100644 --- a/fin_depo/__init__.py +++ b/fin_depo/__init__.py @@ -68,24 +68,30 @@ from ._version import __version__ logger = logging.getLogger(__name__) +CURRENT_MODULE = sys.modules[__name__] -current_module = sys.modules[__name__] def load_backend(name: str) -> object | None: try: imported_module = importlib.import_module(f'{__name__}.{name}') - current_module.setmember(name, imported_module) + CURRENT_MODULE.setmember(name, imported_module) except 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, ) return None + # Import modules -backend_modules = ['defi_kraken', 'defi_kucoin', 'investbank_nordnet', 'defi_partisia_blockchain'] +backend_modules = [ + 'defi_kraken', + 'defi_kucoin', + 'investbank_nordnet', + 'defi_partisia_blockchain', +] for m in backend_modules: load_backend(m) del m -del backend_modules, current_module +del backend_modules, CURRENT_MODULE diff --git a/setup.py b/setup.py index 50476b3..766e4aa 100644 --- a/setup.py +++ b/setup.py @@ -76,15 +76,15 @@ with open(PACKAGE_NAME + '/_version.py') as f: REQUIREMENTS_MAIN = [ - 'enforce-typing', - 'python-kucoin', - 'krakenex', - 'frozendict', - 'fin-defs @ git+https://gitfub.space/Jmaa/fin-defs.git', + 'enforce-typing', + 'python-kucoin', + 'krakenex', + 'frozendict', + 'fin-defs @ git+https://gitfub.space/Jmaa/fin-defs.git', ] REQUIREMENTS_TEST = [ - 'pytest', - 'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader.git', + 'pytest', + 'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader.git', ]