@@ -23,9 +23,13 @@
|
23 | 23 | import asyncio |
24 | 24 | import concurrent.futures |
25 | 25 | import contextlib |
| 26 | +import sys |
26 | 27 | from typing import Any, Awaitable, Coroutine, Optional, Set |
27 | 28 | |
28 | | -import async_timeout |
| 29 | +if sys.version_info[:2] < (3, 11): |
| 30 | +from async_timeout import timeout as asyncio_timeout |
| 31 | +else: |
| 32 | +from asyncio import timeout as asyncio_timeout |
29 | 33 | |
30 | 34 | from .._exceptions import EventLoopBlocked |
31 | 35 | from ..const import _LOADED_SYSTEM_TIMEOUT |
@@ -40,7 +44,7 @@
|
40 | 44 | async def wait_event_or_timeout(event: asyncio.Event, timeout: float) -> None: |
41 | 45 | """Wait for an event or timeout.""" |
42 | 46 | with contextlib.suppress(asyncio.TimeoutError): |
43 | | -async with async_timeout.timeout(timeout): |
| 47 | +async with asyncio_timeout(timeout): |
44 | 48 | await event.wait() |
45 | 49 | |
46 | 50 | |
|