68 lines
2.4 KiB
Python
68 lines
2.4 KiB
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from types import ModuleType
|
|
|
|
from .application import accounts_write_services as _accounts_write_services
|
|
from .application import asset_account_services as _asset_account_services
|
|
from .application import assets_service as _assets_service
|
|
from .application import budgets_write_services as _budgets_write_services
|
|
from .application import category_rules_write_services as _category_rules_write_services
|
|
from .application import categorization_services as _categorization_services
|
|
from .application import cross_transfer_service as _cross_transfer_service
|
|
from .application import imports_service as _imports_service
|
|
from .application import import_transfer_services as _import_transfer_services
|
|
from .application import reconciliation_service as _reconciliation_service
|
|
from .application import shared as _shared
|
|
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
|
|
|
|
# Keep compatibility for tests/monkeypatches that reach into service internals.
|
|
_current_kst_datetime = _shared._current_kst_datetime
|
|
|
|
_PROXY_MODULES = (
|
|
_shared,
|
|
_accounts_write_services,
|
|
_system_services,
|
|
_asset_account_services,
|
|
_assets_service,
|
|
_budgets_write_services,
|
|
_category_rules_write_services,
|
|
_transaction_report_services,
|
|
_reconciliation_service,
|
|
_imports_service,
|
|
_import_transfer_services,
|
|
_cross_transfer_service,
|
|
_categorization_services,
|
|
_uncategorized_workbench_service,
|
|
_transactions_write_services,
|
|
)
|
|
|
|
|
|
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)
|
|
for module in _PROXY_MODULES:
|
|
if hasattr(module, name):
|
|
setattr(module, name, value)
|
|
|
|
|
|
sys.modules[__name__].__class__ = _ServiceModule
|