24 lines
989 B
Python
Executable File
24 lines
989 B
Python
Executable File
# [DEF:backend.src.api.routes.__init__:Module]
|
|
# @TIER: STANDARD
|
|
# @SEMANTICS: routes, lazy-import, module-registry
|
|
# @PURPOSE: Provide lazy route module loading to avoid heavyweight imports during tests.
|
|
# @LAYER: API
|
|
# @RELATION: DEPENDS_ON -> importlib
|
|
# @INVARIANT: Only names listed in __all__ are importable via __getattr__.
|
|
|
|
__all__ = ['plugins', 'tasks', 'settings', 'connections', 'environments', 'mappings', 'migration', 'git', 'storage', 'admin', 'reports', 'assistant']
|
|
|
|
|
|
# [DEF:__getattr__:Function]
|
|
# @TIER: TRIVIAL
|
|
# @PURPOSE: Lazily import route module by attribute name.
|
|
# @PRE: name is module candidate exposed in __all__.
|
|
# @POST: Returns imported submodule or raises AttributeError.
|
|
def __getattr__(name):
|
|
if name in __all__:
|
|
import importlib
|
|
return importlib.import_module(f".{name}", __name__)
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
# [/DEF:__getattr__:Function]
|
|
# [/DEF:backend.src.api.routes.__init__:Module]
|