mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
8 lines
259 B
Python
8 lines
259 B
Python
import asyncio
|
|
from functools import partial
|
|
|
|
def run_in_executor(func, *args, executor=None, **kwargs):
|
|
callback = partial(func, *args, **kwargs)
|
|
loop = asyncio.get_event_loop()
|
|
return asyncio.get_event_loop().run_in_executor(executor, callback)
|