This commit is contained in:
yumoqing 2024-08-07 11:46:33 +08:00
parent 4b1fd99738
commit 4381c9e572

View File

@ -14,10 +14,10 @@ def awaitify(sync_func):
return async_func return async_func
def coroutinify(func): def coroutinify(func):
@wraps(sync_func) @wraps(func)
async def async_func(*args): async def async_func(*args):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, sync_func, *args) return await loop.run_in_executor(None, func, *args)
return async_func return async_func
def to_func(func): def to_func(func):