From: Martijn Pieters Date: Wed, 30 Nov 2022 13:11:22 +0000 (+0000) Subject: Enable no_implicit_reexport (#2475) X-Git-Tag: 0.23.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57aa5b08a48c82a6e1a1500e131d94a31128b6f9;p=thirdparty%2Fhttpx.git Enable no_implicit_reexport (#2475) - Add explicit exports for names imported from `_compat` - Correct imports of `URL` (from `._urls`, not via `._models`) - Correct import of the uvicorn `Server` class Co-authored-by: Tom Christie --- diff --git a/httpx/_compat.py b/httpx/_compat.py index f6a9ba69..a9b9c630 100644 --- a/httpx/_compat.py +++ b/httpx/_compat.py @@ -38,3 +38,6 @@ else: context.options |= ssl.OP_NO_SSLv3 context.options |= ssl.OP_NO_TLSv1 context.options |= ssl.OP_NO_TLSv1_1 + + +__all__ = ["brotli", "set_minimum_tls_version_1_2"] diff --git a/httpx/_config.py b/httpx/_config.py index a4e8f6ce..0187eec4 100644 --- a/httpx/_config.py +++ b/httpx/_config.py @@ -7,8 +7,9 @@ from pathlib import Path import certifi from ._compat import set_minimum_tls_version_1_2 -from ._models import URL, Headers +from ._models import Headers from ._types import CertTypes, HeaderTypes, TimeoutTypes, URLTypes, VerifyTypes +from ._urls import URL from ._utils import get_ca_bundle_from_env, get_logger DEFAULT_CIPHERS = ":".join( diff --git a/httpx/_utils.py b/httpx/_utils.py index c1e9a38b..126936db 100644 --- a/httpx/_utils.py +++ b/httpx/_utils.py @@ -16,7 +16,7 @@ import sniffio from ._types import PrimitiveData if typing.TYPE_CHECKING: # pragma: no cover - from ._models import URL + from ._urls import URL _HTML5_FORM_ENCODING_REPLACEMENTS = {'"': "%22", "\\": "\\\\"} @@ -465,7 +465,7 @@ class URLPattern: """ def __init__(self, pattern: str) -> None: - from ._models import URL + from ._urls import URL if pattern and ":" not in pattern: raise ValueError( diff --git a/setup.cfg b/setup.cfg index 15dd84c2..58cb1d22 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,7 @@ disallow_untyped_decorators = True warn_redundant_casts = True strict_concatenate = True disallow_incomplete_defs = True +no_implicit_reexport = True warn_return_any = True [mypy-tests.*] diff --git a/tests/conftest.py b/tests/conftest.py index cb4bf422..89024ba1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,7 +15,7 @@ from cryptography.hazmat.primitives.serialization import ( load_pem_private_key, ) from uvicorn.config import Config -from uvicorn.main import Server +from uvicorn.server import Server from httpx import URL from tests.concurrency import sleep