Files
ss-tools/backend/src/api/routes/__init__.py
2026-03-27 21:27:31 +03:00

60 lines
1.7 KiB
Python
Executable File

# [DEF:ApiRoutesModule:Module]
# @COMPLEXITY: 3
# @SEMANTICS: routes, lazy-import, module-registry
# @PURPOSE: Provide lazy route module loading to avoid heavyweight imports during tests.
# @LAYER: API
# @RELATION: [CALLS] ->[ApiRoutesGetAttr]
# @RELATION: [BINDS_TO] ->[Route_Group_Contracts]
# @INVARIANT: Only names listed in __all__ are importable via __getattr__.
# [DEF:Route_Group_Contracts:Block]
# @COMPLEXITY: 3
# @PURPOSE: Declare the canonical route-module registry used by lazy imports and app router inclusion.
# @RELATION: DEPENDS_ON -> [PluginsRouter]
# @RELATION: DEPENDS_ON -> [TasksRouter]
# @RELATION: DEPENDS_ON -> [SettingsRouter]
# @RELATION: DEPENDS_ON -> [ConnectionsRouter]
# @RELATION: DEPENDS_ON -> [ReportsRouter]
# @RELATION: DEPENDS_ON -> [LlmRoutes]
__all__ = [
"plugins",
"tasks",
"settings",
"connections",
"environments",
"mappings",
"migration",
"git",
"storage",
"admin",
"reports",
"assistant",
"clean_release",
"clean_release_v2",
"profile",
"dataset_review",
"llm",
"dashboards",
"datasets",
"health",
]
# [/DEF:Route_Group_Contracts:Block]
# [DEF:ApiRoutesGetAttr:Function]
# @COMPLEXITY: 3
# @PURPOSE: Lazily import route module by attribute name.
# @RELATION: [DEPENDS_ON] ->[ApiRoutesModule]
# @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:ApiRoutesGetAttr:Function]
# [/DEF:ApiRoutesModule:Module]