import asyncio
import functools
def executor(f):
@functools.wraps(f)
async def wrapped(*args, **kwargs):
return await asyncio.get_running_loop().run_in_executor(
None, lambda: f(*args, **kwargs)
)
return wrapped