from __future__ import annotations from typing import TypedDict class ServerModuleItem(TypedDict): name: str init: callable _SERVER_MODULES: list[ServerModuleItem] = [] def register_server_module(name: str, init_method: callable): global _SERVER_MODULES for module in _SERVER_MODULES: if module["name"] == name: return _SERVER_MODULES.append({ "name": name, "init": init_method }) def get_server_modules() -> list[ServerModuleItem]: return _SERVER_MODULES