def current_task(loop: asyncio.AbstractEventLoop) -> "asyncio.Task[Any]": if PY_37: task = asyncio.current_task(loop=loop) else: task = asyncio.Task.current_task(loop=loop) if task is None: if hasattr(loop, "current_task"): task = loop.current_task() return task
def current_task(loop: asyncio.AbstractEventLoop) -> "asyncio.Task[Any]": if PY_37: task = asyncio.current_task(loop=loop) # type: ignore else: task = asyncio.Task.current_task(loop=loop) if task is None: # this should be removed, tokio must use register_task and family API if hasattr(loop, "current_task"): task = loop.current_task() # type: ignore return task
def current_task(loop: asyncio.AbstractEventLoop) -> asyncio.Task: if PY_37: task = asyncio.current_task(loop=loop) # type: ignore else: task = asyncio.Task.current_task(loop=loop) if task is None: # this should be removed, tokio must use register_task and family API if hasattr(loop, 'current_task'): task = loop.current_task() # type: ignore return task