This commit is contained in:
yumoqing 2024-02-03 12:04:38 +08:00
parent 99310f4b3b
commit b97c946891

View File

@ -2,6 +2,14 @@ import random
import asyncio import asyncio
import inspect import inspect
from functools import wraps from functools import wraps
from functools import wraps
def awaitify(sync_func):
"""Wrap a synchronous callable to allow ``await``'ing it"""
@wraps(sync_func)
async def async_func(*args, **kwargs):
return sync_func(*args, **kwargs)
return async_func
def to_func(func): def to_func(func):
@wraps(func) @wraps(func)