refactor: make compatibility exports ruff clean
This commit is contained in:
+15
-11
@@ -18,17 +18,6 @@ from .application import system_services as _system_services
|
||||
from .application import transactions_write_services as _transactions_write_services
|
||||
from .application import transaction_report_services as _transaction_report_services
|
||||
from .application import uncategorized_workbench_service as _uncategorized_workbench_service
|
||||
from .application.asset_account_services import *
|
||||
from .application.assets_service import *
|
||||
from .application.categorization_services import *
|
||||
from .application.cross_transfer_service import *
|
||||
from .application.imports_service import *
|
||||
from .application.import_transfer_services import *
|
||||
from .application.reconciliation_service import *
|
||||
from .application.shared import *
|
||||
from .application.system_services import *
|
||||
from .application.transaction_report_services import *
|
||||
from .application.uncategorized_workbench_service import *
|
||||
|
||||
# Keep compatibility for tests/monkeypatches that reach into service internals.
|
||||
_current_kst_datetime = _shared._current_kst_datetime
|
||||
@@ -52,6 +41,21 @@ _PROXY_MODULES = (
|
||||
)
|
||||
|
||||
|
||||
def _export_public_names() -> list[str]:
|
||||
exported: set[str] = set()
|
||||
module_globals = globals()
|
||||
for module in _PROXY_MODULES:
|
||||
for name in dir(module):
|
||||
if name.startswith("_"):
|
||||
continue
|
||||
module_globals.setdefault(name, getattr(module, name))
|
||||
exported.add(name)
|
||||
return sorted(exported)
|
||||
|
||||
|
||||
__all__ = _export_public_names()
|
||||
|
||||
|
||||
class _ServiceModule(ModuleType):
|
||||
def __setattr__(self, name: str, value) -> None:
|
||||
super().__setattr__(name, value)
|
||||
|
||||
Reference in New Issue
Block a user