From c24bbb85a6efd83beb2ed6aab37913e4e0d44418 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 3 Sep 2021 14:51:42 +0100 Subject: [PATCH] Fix conditional imports for pyright (#1839) --- httpx/_compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httpx/_compat.py b/httpx/_compat.py index 15e915a9..ed61e98f 100644 --- a/httpx/_compat.py +++ b/httpx/_compat.py @@ -7,9 +7,9 @@ import sys # `contextlib.asynccontextmanager` exists from Python 3.7 onwards. # For 3.6 we require the `async_generator` package for a backported version. -try: +if sys.version_info >= (3, 7): from contextlib import asynccontextmanager # type: ignore -except ImportError: +else: from async_generator import asynccontextmanager # type: ignore # noqa # Brotli support is optional -- 2.47.3