You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
758 B
34 lines
758 B
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import sys
|
|
from typing import Any, Dict
|
|
|
|
|
|
__all__ = ["asyncio_timeout", "loop_if_py_lt_38"]
|
|
|
|
|
|
if sys.version_info[:2] >= (3, 8):
|
|
|
|
def loop_if_py_lt_38(loop: asyncio.AbstractEventLoop) -> Dict[str, Any]:
|
|
"""
|
|
Helper for the removal of the loop argument in Python 3.10.
|
|
|
|
"""
|
|
return {}
|
|
|
|
else:
|
|
|
|
def loop_if_py_lt_38(loop: asyncio.AbstractEventLoop) -> Dict[str, Any]:
|
|
"""
|
|
Helper for the removal of the loop argument in Python 3.10.
|
|
|
|
"""
|
|
return {"loop": loop}
|
|
|
|
|
|
if sys.version_info[:2] >= (3, 11):
|
|
from asyncio import timeout as asyncio_timeout # noqa: F401
|
|
else:
|
|
from .async_timeout import timeout as asyncio_timeout # noqa: F401
|