1
0
forked from bot/app

🐛 在结束进程时无法杀死进程的问题

This commit is contained in:
2024-08-15 16:40:29 +08:00
parent 0d5f9fee52
commit a61357f4e2
14 changed files with 108 additions and 86 deletions

View File

@ -72,3 +72,18 @@ def path_to_module_name(path: Path) -> str:
return ".".join(rel_path.parts[:-1])
else:
return ".".join(rel_path.parts[:-1] + (rel_path.stem,))
def async_wrapper(func: Callable[..., Any]) -> Callable[..., Coroutine]:
"""
异步包装器
Args:
func: Sync Callable
Returns:
Coroutine: Asynchronous Callable
"""
async def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper.__signature__ = inspect.signature(func)
return wrapper