master
yumoqing 2024-02-03 12:04:38 +08:00
parent 99310f4b3b
commit b97c946891
1 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,14 @@ import random
import asyncio
import inspect
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):
@wraps(func)