mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 23:38:49 +00:00
Avoid eager imports to fix circular dependency
This commit is contained in:
@@ -1,21 +1,16 @@
|
|||||||
# nostr/__init__.py
|
# nostr/__init__.py
|
||||||
|
|
||||||
import logging
|
"""Nostr package exposing :class:`NostrClient` lazily."""
|
||||||
import traceback
|
|
||||||
from .client import NostrClient
|
from importlib import import_module
|
||||||
|
import logging
|
||||||
|
|
||||||
# Instantiate the logger
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Initialize the logger for this module
|
|
||||||
logger = logging.getLogger(__name__) # Correct logger initialization
|
|
||||||
|
|
||||||
try:
|
|
||||||
from .client import NostrClient
|
|
||||||
|
|
||||||
logger.info("NostrClient module imported successfully.")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Failed to import NostrClient module: {e}")
|
|
||||||
logger.error(traceback.format_exc()) # Log full traceback
|
|
||||||
|
|
||||||
__all__ = ["NostrClient"]
|
__all__ = ["NostrClient"]
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str):
|
||||||
|
if name == "NostrClient":
|
||||||
|
return import_module(".client", __name__).NostrClient
|
||||||
|
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
||||||
|
@@ -1,30 +1,17 @@
|
|||||||
# password_manager/__init__.py
|
# password_manager/__init__.py
|
||||||
|
|
||||||
import logging
|
"""Expose password manager components with lazy imports."""
|
||||||
import traceback
|
|
||||||
|
|
||||||
try:
|
from importlib import import_module
|
||||||
from .manager import PasswordManager
|
|
||||||
|
|
||||||
logging.info("PasswordManager module imported successfully.")
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Failed to import PasswordManager module: {e}")
|
|
||||||
logging.error(traceback.format_exc()) # Log full traceback
|
|
||||||
|
|
||||||
try:
|
|
||||||
from .config_manager import ConfigManager
|
|
||||||
|
|
||||||
logging.info("ConfigManager module imported successfully.")
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Failed to import ConfigManager module: {e}")
|
|
||||||
logging.error(traceback.format_exc())
|
|
||||||
|
|
||||||
try:
|
|
||||||
from .vault import Vault
|
|
||||||
|
|
||||||
logging.info("Vault module imported successfully.")
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Failed to import Vault module: {e}")
|
|
||||||
logging.error(traceback.format_exc())
|
|
||||||
|
|
||||||
__all__ = ["PasswordManager", "ConfigManager", "Vault"]
|
__all__ = ["PasswordManager", "ConfigManager", "Vault"]
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str):
|
||||||
|
if name == "PasswordManager":
|
||||||
|
return import_module(".manager", __name__).PasswordManager
|
||||||
|
if name == "ConfigManager":
|
||||||
|
return import_module(".config_manager", __name__).ConfigManager
|
||||||
|
if name == "Vault":
|
||||||
|
return import_module(".vault", __name__).Vault
|
||||||
|
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
||||||
|
Reference in New Issue
Block a user