You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
533 B
Python

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