From f9664a43250151e6448dbf98a111ff0e81688ec9 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 22 May 2024 15:16:42 +0200 Subject: [PATCH] [requests] Update to 2.32.2 (#12000) Also replace some `Any` annotations with `Incomplete` and use `Final` in `requests.__version__`. --- stubs/requests/requests/__version__.pyi | 22 ++++++++++++---------- stubs/requests/requests/adapters.pyi | 23 +++++++++++++++++------ stubs/requests/requests/utils.pyi | 14 ++++++++------ 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/stubs/requests/requests/__version__.pyi b/stubs/requests/requests/__version__.pyi index fe5db3dfd..05c93ebcb 100644 --- a/stubs/requests/requests/__version__.pyi +++ b/stubs/requests/requests/__version__.pyi @@ -1,10 +1,12 @@ -__title__: str -__description__: str -__url__: str -__version__: str -__build__: int -__author__: str -__author_email__: str -__license__: str -__copyright__: str -__cake__: str +from typing import Final + +__title__: Final = "requests" +__description__: Final[str] +__url__: Final[str] +__version__: Final[str] +__build__: Final[int] +__author__: Final[str] +__author_email__: Final[str] +__license__: Final[str] +__copyright__: Final[str] +__cake__: Final[str] diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 664104cb2..4e540e94f 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -1,6 +1,8 @@ +from _typeshed import Incomplete from collections.abc import Mapping -from typing import Any +from typing_extensions import deprecated +from urllib3.connectionpool import ConnectionPool from urllib3.contrib.socks import SOCKSProxyManager as SOCKSProxyManager from urllib3.exceptions import ( ConnectTimeoutError as ConnectTimeoutError, @@ -25,6 +27,7 @@ from .models import PreparedRequest, Response as Response from .structures import CaseInsensitiveDict as CaseInsensitiveDict from .utils import ( DEFAULT_CA_BUNDLE_PATH as DEFAULT_CA_BUNDLE_PATH, + _Uri, get_auth_from_url as get_auth_from_url, get_encoding_from_headers as get_encoding_from_headers, prepend_scheme_if_needed as prepend_scheme_if_needed, @@ -50,19 +53,27 @@ class BaseAdapter: def close(self) -> None: ... class HTTPAdapter(BaseAdapter): - __attrs__: Any + __attrs__: Incomplete max_retries: Retry - config: Any - proxy_manager: Any + config: Incomplete + proxy_manager: Incomplete def __init__( self, pool_connections: int = 10, pool_maxsize: int = 10, max_retries: Retry | int | None = 0, pool_block: bool = False ) -> None: ... - poolmanager: Any + poolmanager: Incomplete def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs): ... def proxy_manager_for(self, proxy, **proxy_kwargs): ... def cert_verify(self, conn, url, verify, cert): ... def build_response(self, req, resp): ... - def get_connection(self, url, proxies=None): ... + def get_connection_with_tls_context( + self, + request: PreparedRequest, + verify: bool | str | None, + proxies: Mapping[str, str] | None = None, + cert: tuple[str, str] | str | None = None, + ) -> ConnectionPool: ... + @deprecated("Use get_connection_with_tls_context() instead.") + def get_connection(self, url: _Uri, proxies: Mapping[str, str] | None = None) -> ConnectionPool: ... def close(self): ... def request_url(self, request, proxies): ... def add_headers(self, request, **kwargs): ... diff --git a/stubs/requests/requests/utils.pyi b/stubs/requests/requests/utils.pyi index f5805d81d..3edd7c103 100644 --- a/stubs/requests/requests/utils.pyi +++ b/stubs/requests/requests/utils.pyi @@ -1,9 +1,9 @@ import sys -from _typeshed import StrOrBytesPath +from _typeshed import Incomplete, StrOrBytesPath from collections.abc import Generator, Iterable, Mapping from contextlib import _GeneratorContextManager from io import BufferedWriter -from typing import Any, AnyStr +from typing import AnyStr from typing_extensions import TypeAlias from . import compat, cookies, exceptions, structures @@ -16,7 +16,7 @@ CaseInsensitiveDict = structures.CaseInsensitiveDict InvalidURL = exceptions.InvalidURL NETRC_FILES: tuple[str, str] -DEFAULT_CA_BUNDLE_PATH: Any +DEFAULT_CA_BUNDLE_PATH: Incomplete DEFAULT_PORTS: dict[str, int] DEFAULT_ACCEPT_ENCODING: str @@ -49,9 +49,11 @@ def is_ipv4_address(string_ip: str) -> bool: ... def is_valid_cidr(string_network: str) -> bool: ... def set_environ(env_name: str, value: None) -> _GeneratorContextManager[None]: ... def should_bypass_proxies(url: _Uri, no_proxy: Iterable[str] | None) -> bool: ... -def get_environ_proxies(url: _Uri, no_proxy: Iterable[str] | None = None) -> dict[Any, Any]: ... -def select_proxy(url: _Uri, proxies: Mapping[Any, Any] | None): ... -def resolve_proxies(request: Request | PreparedRequest, proxies: Mapping[str, str] | None, trust_env: bool = True): ... +def get_environ_proxies(url: _Uri, no_proxy: Iterable[str] | None = None) -> dict[Incomplete, Incomplete]: ... +def select_proxy(url: _Uri, proxies: Mapping[str, str] | None) -> str: ... +def resolve_proxies( + request: Request | PreparedRequest, proxies: dict[str, str] | None, trust_env: bool = True +) -> dict[str, str]: ... def default_user_agent(name: str = "python-requests") -> str: ... def default_headers() -> CaseInsensitiveDict[str]: ... def parse_header_links(value: str) -> list[dict[str, str]]: ...