mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-11 04:07:23 +08:00
📝 修复生成文档中self多出类型注解的问题,修复__init__丢失的问题
This commit is contained in:
parent
85a3a9ad52
commit
cdbede7135
@ -57,23 +57,33 @@ Returns:
|
||||
|
||||
|
||||
|
||||
###   ***def*** `run(self: Any) -> None`
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 初始化轻雪实例
|
||||
|
||||
Args:
|
||||
|
||||
*args:
|
||||
|
||||
**kwargs: 配置
|
||||
|
||||
###   ***def*** `run(self) -> None`
|
||||
|
||||
 启动逻辑
|
||||
|
||||
###   ***def*** `keep_alive(self: Any) -> None`
|
||||
###   ***def*** `keep_alive(self) -> None`
|
||||
|
||||
 保持轻雪运行
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `restart(self: Any, delay: int) -> None`
|
||||
###   ***def*** `restart(self, delay: int) -> None`
|
||||
|
||||
 重启轻雪本体
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `restart_process(self: Any, name: Optional[str]) -> None`
|
||||
###   ***def*** `restart_process(self, name: Optional[str]) -> None`
|
||||
|
||||
 停止轻雪
|
||||
|
||||
@ -83,23 +93,23 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `init(self: Any) -> None`
|
||||
###   ***def*** `init(self) -> None`
|
||||
|
||||
 初始化轻雪, 自动调用
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `init_logger(self: Any) -> None`
|
||||
###   ***def*** `init_logger(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `stop(self: Any) -> None`
|
||||
###   ***def*** `stop(self) -> None`
|
||||
|
||||
 停止轻雪
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_start(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_start(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册启动前的函数
|
||||
|
||||
@ -111,7 +121,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_start(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_start(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册启动后的函数
|
||||
|
||||
@ -123,7 +133,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_shutdown(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_shutdown(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册停止后的函数:未实现
|
||||
|
||||
@ -135,7 +145,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_process_shutdown(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_process_shutdown(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册进程停止前的函数,为子进程停止时调用
|
||||
|
||||
@ -147,7 +157,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_process_restart(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_process_restart(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册进程重启前的函数,为子进程重启时调用
|
||||
|
||||
@ -159,7 +169,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_restart(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_restart(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册重启后的函数:未实现
|
||||
|
||||
@ -171,7 +181,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_nonebot_init(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_nonebot_init(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册nonebot初始化后的函数
|
||||
|
||||
|
@ -19,6 +19,10 @@ Returns:
|
||||
|
||||
|
||||
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 轻雪生命周期管理,启动、停止、重启
|
||||
|
||||
###   ***@staticmethod***
|
||||
###   ***def*** `run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None`
|
||||
|
||||
@ -30,7 +34,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_start(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册启动时的函数
|
||||
|
||||
@ -42,7 +46,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_start(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册启动时的函数
|
||||
|
||||
@ -54,7 +58,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_before_process_shutdown(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_process_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册停止前的函数
|
||||
|
||||
@ -66,7 +70,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_shutdown(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册停止后的函数
|
||||
|
||||
@ -80,7 +84,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_before_process_restart(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_process_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册重启时的函数
|
||||
|
||||
@ -92,7 +96,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_restart(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册重启后的函数
|
||||
|
||||
@ -104,7 +108,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_nonebot_init(self: Any, func: Any) -> None`
|
||||
###   ***def*** `on_after_nonebot_init(self, func: Any) -> None`
|
||||
|
||||
 注册 NoneBot 初始化后的函数
|
||||
|
||||
@ -116,37 +120,37 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_start(self: Any) -> None`
|
||||
###   ***def*** `before_start(self) -> None`
|
||||
|
||||
 启动前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_start(self: Any) -> None`
|
||||
###   ***def*** `after_start(self) -> None`
|
||||
|
||||
 启动后
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_process_shutdown(self: Any) -> None`
|
||||
###   ***def*** `before_process_shutdown(self) -> None`
|
||||
|
||||
 停止前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_shutdown(self: Any) -> None`
|
||||
###   ***def*** `after_shutdown(self) -> None`
|
||||
|
||||
 停止后
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_process_restart(self: Any) -> None`
|
||||
###   ***def*** `before_process_restart(self) -> None`
|
||||
|
||||
 重启前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_restart(self: Any) -> None`
|
||||
###   ***def*** `after_restart(self) -> None`
|
||||
|
||||
 重启后
|
||||
|
||||
|
@ -65,7 +65,15 @@ Returns:
|
||||
|
||||
有两种接收工作方式,但是只能选择一种,主动接收和被动接收,主动接收使用 `receive` 方法,被动接收使用 `on_receive` 装饰器
|
||||
|
||||
###   ***def*** `send(self: Any, data: T) -> None`
|
||||
###   ***def*** `__init__(self, _id: str, type_check: bool) -> None`
|
||||
|
||||
 初始化通道
|
||||
|
||||
Args:
|
||||
|
||||
_id: 通道ID
|
||||
|
||||
###   ***def*** `send(self, data: T) -> None`
|
||||
|
||||
 发送数据
|
||||
|
||||
@ -73,17 +81,17 @@ Args:
|
||||
|
||||
data: 数据
|
||||
|
||||
###   ***def*** `receive(self: Any) -> T`
|
||||
###   ***def*** `receive(self) -> T`
|
||||
|
||||
 接收数据
|
||||
|
||||
Args:
|
||||
|
||||
###   ***def*** `close(self: Any) -> None`
|
||||
###   ***def*** `close(self) -> None`
|
||||
|
||||
 关闭通道
|
||||
|
||||
###   ***def*** `on_receive(self: Any, filter_func: Optional[FILTER_FUNC]) -> Callable[[Callable[[T], Any]], Callable[[T], Any]]`
|
||||
###   ***def*** `on_receive(self, filter_func: Optional[FILTER_FUNC]) -> Callable[[Callable[[T], Any]], Callable[[T], Any]]`
|
||||
|
||||
 接收数据并执行函数
|
||||
|
||||
|
@ -9,3 +9,7 @@ category: API
|
||||
|
||||
事件类
|
||||
|
||||
###   ***def*** `__init__(self, name: str, data: dict[str, Any]) -> None`
|
||||
|
||||
 
|
||||
|
||||
|
@ -25,7 +25,11 @@ category: API
|
||||
|
||||
|
||||
|
||||
###   ***def*** `set(self: Any, key: str, value: Any) -> None`
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `set(self, key: str, value: Any) -> None`
|
||||
|
||||
 设置键值对
|
||||
|
||||
@ -35,7 +39,7 @@ Args:
|
||||
|
||||
value: 值
|
||||
|
||||
###   ***def*** `get(self: Any, key: str, default: Optional[Any]) -> Optional[Any]`
|
||||
###   ***def*** `get(self, key: str, default: Optional[Any]) -> Optional[Any]`
|
||||
|
||||
 获取键值对
|
||||
|
||||
@ -51,7 +55,7 @@ Returns:
|
||||
|
||||
Any: 值
|
||||
|
||||
###   ***def*** `delete(self: Any, key: str, ignore_key_error: bool) -> None`
|
||||
###   ***def*** `delete(self, key: str, ignore_key_error: bool) -> None`
|
||||
|
||||
 删除键值对
|
||||
|
||||
@ -65,7 +69,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `get_all(self: Any) -> dict[str, Any]`
|
||||
###   ***def*** `get_all(self) -> dict[str, Any]`
|
||||
|
||||
 获取所有键值对
|
||||
|
||||
|
@ -9,11 +9,19 @@ category: API
|
||||
|
||||
|
||||
|
||||
###   ***def*** `__init__(self, active: Channel[Any], passive: Channel[Any], channel_deliver_active: Channel[Channel[Any]], channel_deliver_passive: Channel[tuple[str, dict]]) -> None`
|
||||
|
||||
 
|
||||
|
||||
### ***class*** `ProcessManager`
|
||||
|
||||
进程管理器
|
||||
|
||||
###   ***def*** `start(self: Any, name: str) -> None`
|
||||
###   ***def*** `__init__(self, lifespan: 'Lifespan') -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `start(self, name: str) -> None`
|
||||
|
||||
 开启后自动监控进程,并添加到进程字典中
|
||||
|
||||
@ -23,11 +31,11 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `start_all(self: Any) -> None`
|
||||
###   ***def*** `start_all(self) -> None`
|
||||
|
||||
 启动所有进程
|
||||
|
||||
###   ***def*** `add_target(self: Any, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
|
||||
###   ***def*** `add_target(self, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
|
||||
|
||||
 添加进程
|
||||
|
||||
@ -41,11 +49,11 @@ Args:
|
||||
|
||||
kwargs: 进程函数关键字参数,通常会默认传入chan_active和chan_passive
|
||||
|
||||
###   ***def*** `join_all(self: Any) -> None`
|
||||
###   ***def*** `join_all(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `terminate(self: Any, name: str) -> None`
|
||||
###   ***def*** `terminate(self, name: str) -> None`
|
||||
|
||||
 终止进程并从进程字典中删除
|
||||
|
||||
@ -57,11 +65,11 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `terminate_all(self: Any) -> None`
|
||||
###   ***def*** `terminate_all(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `is_process_alive(self: Any, name: str) -> bool`
|
||||
###   ***def*** `is_process_alive(self, name: str) -> bool`
|
||||
|
||||
 检查进程是否存活
|
||||
|
||||
|
@ -45,23 +45,23 @@ Returns:
|
||||
|
||||
Handler for code file changes
|
||||
|
||||
###   ***def*** `on_modified(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_modified(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_created(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_created(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_deleted(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_deleted(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_moved(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_moved(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_any_event(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_any_event(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
|
@ -57,23 +57,33 @@ Returns:
|
||||
|
||||
|
||||
|
||||
###   ***def*** `run(self: Any) -> None`
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 初始化轻雪实例
|
||||
|
||||
Args:
|
||||
|
||||
*args:
|
||||
|
||||
**kwargs: 配置
|
||||
|
||||
###   ***def*** `run(self) -> None`
|
||||
|
||||
 启动逻辑
|
||||
|
||||
###   ***def*** `keep_alive(self: Any) -> None`
|
||||
###   ***def*** `keep_alive(self) -> None`
|
||||
|
||||
 保持轻雪运行
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `restart(self: Any, delay: int) -> None`
|
||||
###   ***def*** `restart(self, delay: int) -> None`
|
||||
|
||||
 重启轻雪本体
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `restart_process(self: Any, name: Optional[str]) -> None`
|
||||
###   ***def*** `restart_process(self, name: Optional[str]) -> None`
|
||||
|
||||
 停止轻雪
|
||||
|
||||
@ -83,23 +93,23 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `init(self: Any) -> None`
|
||||
###   ***def*** `init(self) -> None`
|
||||
|
||||
 初始化轻雪, 自动调用
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `init_logger(self: Any) -> None`
|
||||
###   ***def*** `init_logger(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `stop(self: Any) -> None`
|
||||
###   ***def*** `stop(self) -> None`
|
||||
|
||||
 停止轻雪
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_start(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_start(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册启动前的函数
|
||||
|
||||
@ -111,7 +121,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_start(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_start(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册启动后的函数
|
||||
|
||||
@ -123,7 +133,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_shutdown(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_shutdown(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册停止后的函数:未实现
|
||||
|
||||
@ -135,7 +145,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_process_shutdown(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_process_shutdown(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册进程停止前的函数,为子进程停止时调用
|
||||
|
||||
@ -147,7 +157,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_process_restart(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_before_process_restart(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册进程重启前的函数,为子进程重启时调用
|
||||
|
||||
@ -159,7 +169,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_restart(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_restart(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册重启后的函数:未实现
|
||||
|
||||
@ -171,7 +181,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_after_nonebot_init(self: Any, func: LIFESPAN_FUNC) -> None`
|
||||
###   ***def*** `on_after_nonebot_init(self, func: LIFESPAN_FUNC) -> None`
|
||||
|
||||
 注册nonebot初始化后的函数
|
||||
|
||||
|
@ -19,6 +19,10 @@ Returns:
|
||||
|
||||
|
||||
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 轻雪生命周期管理,启动、停止、重启
|
||||
|
||||
###   ***@staticmethod***
|
||||
###   ***def*** `run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None`
|
||||
|
||||
@ -30,7 +34,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `on_before_start(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册启动时的函数
|
||||
|
||||
@ -42,7 +46,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_start(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册启动时的函数
|
||||
|
||||
@ -54,7 +58,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_before_process_shutdown(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_process_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册停止前的函数
|
||||
|
||||
@ -66,7 +70,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_shutdown(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册停止后的函数
|
||||
|
||||
@ -80,7 +84,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_before_process_restart(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_before_process_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册重启时的函数
|
||||
|
||||
@ -92,7 +96,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_restart(self: Any, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
###   ***def*** `on_after_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC`
|
||||
|
||||
 注册重启后的函数
|
||||
|
||||
@ -104,7 +108,7 @@ Returns:
|
||||
|
||||
LIFESPAN_FUNC:
|
||||
|
||||
###   ***def*** `on_after_nonebot_init(self: Any, func: Any) -> None`
|
||||
###   ***def*** `on_after_nonebot_init(self, func: Any) -> None`
|
||||
|
||||
 注册 NoneBot 初始化后的函数
|
||||
|
||||
@ -116,37 +120,37 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_start(self: Any) -> None`
|
||||
###   ***def*** `before_start(self) -> None`
|
||||
|
||||
 启动前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_start(self: Any) -> None`
|
||||
###   ***def*** `after_start(self) -> None`
|
||||
|
||||
 启动后
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_process_shutdown(self: Any) -> None`
|
||||
###   ***def*** `before_process_shutdown(self) -> None`
|
||||
|
||||
 停止前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_shutdown(self: Any) -> None`
|
||||
###   ***def*** `after_shutdown(self) -> None`
|
||||
|
||||
 停止后
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `before_process_restart(self: Any) -> None`
|
||||
###   ***def*** `before_process_restart(self) -> None`
|
||||
|
||||
 重启前
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `after_restart(self: Any) -> None`
|
||||
###   ***def*** `after_restart(self) -> None`
|
||||
|
||||
 重启后
|
||||
|
||||
|
@ -65,7 +65,15 @@ Returns:
|
||||
|
||||
有两种接收工作方式,但是只能选择一种,主动接收和被动接收,主动接收使用 `receive` 方法,被动接收使用 `on_receive` 装饰器
|
||||
|
||||
###   ***def*** `send(self: Any, data: T) -> None`
|
||||
###   ***def*** `__init__(self, _id: str, type_check: bool) -> None`
|
||||
|
||||
 初始化通道
|
||||
|
||||
Args:
|
||||
|
||||
_id: 通道ID
|
||||
|
||||
###   ***def*** `send(self, data: T) -> None`
|
||||
|
||||
 发送数据
|
||||
|
||||
@ -73,17 +81,17 @@ Args:
|
||||
|
||||
data: 数据
|
||||
|
||||
###   ***def*** `receive(self: Any) -> T`
|
||||
###   ***def*** `receive(self) -> T`
|
||||
|
||||
 接收数据
|
||||
|
||||
Args:
|
||||
|
||||
###   ***def*** `close(self: Any) -> None`
|
||||
###   ***def*** `close(self) -> None`
|
||||
|
||||
 关闭通道
|
||||
|
||||
###   ***def*** `on_receive(self: Any, filter_func: Optional[FILTER_FUNC]) -> Callable[[Callable[[T], Any]], Callable[[T], Any]]`
|
||||
###   ***def*** `on_receive(self, filter_func: Optional[FILTER_FUNC]) -> Callable[[Callable[[T], Any]], Callable[[T], Any]]`
|
||||
|
||||
 接收数据并执行函数
|
||||
|
||||
|
@ -9,3 +9,7 @@ category: API
|
||||
|
||||
事件类
|
||||
|
||||
###   ***def*** `__init__(self, name: str, data: dict[str, Any]) -> None`
|
||||
|
||||
 
|
||||
|
||||
|
@ -25,7 +25,11 @@ category: API
|
||||
|
||||
|
||||
|
||||
###   ***def*** `set(self: Any, key: str, value: Any) -> None`
|
||||
###   ***def*** `__init__(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `set(self, key: str, value: Any) -> None`
|
||||
|
||||
 设置键值对
|
||||
|
||||
@ -35,7 +39,7 @@ Args:
|
||||
|
||||
value: 值
|
||||
|
||||
###   ***def*** `get(self: Any, key: str, default: Optional[Any]) -> Optional[Any]`
|
||||
###   ***def*** `get(self, key: str, default: Optional[Any]) -> Optional[Any]`
|
||||
|
||||
 获取键值对
|
||||
|
||||
@ -51,7 +55,7 @@ Returns:
|
||||
|
||||
Any: 值
|
||||
|
||||
###   ***def*** `delete(self: Any, key: str, ignore_key_error: bool) -> None`
|
||||
###   ***def*** `delete(self, key: str, ignore_key_error: bool) -> None`
|
||||
|
||||
 删除键值对
|
||||
|
||||
@ -65,7 +69,7 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `get_all(self: Any) -> dict[str, Any]`
|
||||
###   ***def*** `get_all(self) -> dict[str, Any]`
|
||||
|
||||
 获取所有键值对
|
||||
|
||||
|
@ -9,11 +9,19 @@ category: API
|
||||
|
||||
|
||||
|
||||
###   ***def*** `__init__(self, active: Channel[Any], passive: Channel[Any], channel_deliver_active: Channel[Channel[Any]], channel_deliver_passive: Channel[tuple[str, dict]]) -> None`
|
||||
|
||||
 
|
||||
|
||||
### ***class*** `ProcessManager`
|
||||
|
||||
进程管理器
|
||||
|
||||
###   ***def*** `start(self: Any, name: str) -> None`
|
||||
###   ***def*** `__init__(self, lifespan: 'Lifespan') -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `start(self, name: str) -> None`
|
||||
|
||||
 开启后自动监控进程,并添加到进程字典中
|
||||
|
||||
@ -23,11 +31,11 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `start_all(self: Any) -> None`
|
||||
###   ***def*** `start_all(self) -> None`
|
||||
|
||||
 启动所有进程
|
||||
|
||||
###   ***def*** `add_target(self: Any, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
|
||||
###   ***def*** `add_target(self, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
|
||||
|
||||
 添加进程
|
||||
|
||||
@ -41,11 +49,11 @@ Args:
|
||||
|
||||
kwargs: 进程函数关键字参数,通常会默认传入chan_active和chan_passive
|
||||
|
||||
###   ***def*** `join_all(self: Any) -> None`
|
||||
###   ***def*** `join_all(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `terminate(self: Any, name: str) -> None`
|
||||
###   ***def*** `terminate(self, name: str) -> None`
|
||||
|
||||
 终止进程并从进程字典中删除
|
||||
|
||||
@ -57,11 +65,11 @@ Args:
|
||||
|
||||
Returns:
|
||||
|
||||
###   ***def*** `terminate_all(self: Any) -> None`
|
||||
###   ***def*** `terminate_all(self) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `is_process_alive(self: Any, name: str) -> bool`
|
||||
###   ***def*** `is_process_alive(self, name: str) -> bool`
|
||||
|
||||
 检查进程是否存活
|
||||
|
||||
|
@ -45,23 +45,23 @@ Returns:
|
||||
|
||||
Handler for code file changes
|
||||
|
||||
###   ***def*** `on_modified(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_modified(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_created(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_created(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_deleted(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_deleted(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_moved(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_moved(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
###   ***def*** `on_any_event(self: Any, event: Any) -> None`
|
||||
###   ***def*** `on_any_event(self, event: Any) -> None`
|
||||
|
||||
 
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user