๐Ÿ“ฆ encode / httpx

๐Ÿ“„ concurrency.py ยท 16 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16"""
Async environment-agnostic concurrency utilities that are only used in tests.
"""

import asyncio

import sniffio
import trio


async def sleep(seconds: float) -> None:
    if sniffio.current_async_library() == "trio":
        await trio.sleep(seconds)  # pragma: no cover
    else:
        await asyncio.sleep(seconds)