From b35c8f5c26193e5a19951c5606d524a5fabfe75e Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 07:28:03 +0330 Subject: [PATCH 1/4] Update utils.pyi --- stubs/requests/requests/utils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/requests/requests/utils.pyi b/stubs/requests/requests/utils.pyi index b42801bacb8b..b47c21c825e7 100644 --- a/stubs/requests/requests/utils.pyi +++ b/stubs/requests/requests/utils.pyi @@ -49,7 +49,7 @@ 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[Incomplete, Incomplete]: ... -def select_proxy(url: _Uri, proxies: Mapping[str, str] | None) -> str: ... +def select_proxy(url: _Uri, proxies: Mapping[str, str] | None) -> str | None: ... def resolve_proxies( request: Request | PreparedRequest, proxies: dict[str, str] | None, trust_env: bool = True ) -> dict[str, str]: ... From 06f5f92ff20b3e42bac6dbba763fe783be6c2e54 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 07:36:16 +0330 Subject: [PATCH 2/4] Update utils.pyi --- stubs/requests/requests/utils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/requests/requests/utils.pyi b/stubs/requests/requests/utils.pyi index b47c21c825e7..ecd3536463cf 100644 --- a/stubs/requests/requests/utils.pyi +++ b/stubs/requests/requests/utils.pyi @@ -47,7 +47,7 @@ def dotted_netmask(mask: int) -> str: ... 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 should_bypass_proxies(url: _Uri, no_proxy: str | None) -> bool: ... 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 | None: ... def resolve_proxies( From 7f17de71ea8be19172188d3de5ea01b9682140f8 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 13:30:29 +0330 Subject: [PATCH 3/4] Update adapters.pyi --- stubs/requests/requests/adapters.pyi | 37 +++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index a552c0a47053..cb921ad19a28 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete from collections.abc import Mapping from ssl import SSLContext -from typing import Literal, TypedDict, type_check_only +from typing import Any, Literal, TypedDict, type_check_only from typing_extensions import NotRequired, deprecated import urllib3 @@ -80,8 +80,26 @@ class HTTPAdapter(BaseAdapter): self, pool_connections: int = 10, pool_maxsize: int = 10, max_retries: Retry | int | None = 0, pool_block: bool = False ) -> None: ... poolmanager: Incomplete - def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs): ... - def proxy_manager_for(self, proxy, **proxy_kwargs): ... + def init_poolmanager( + self, + connections: int, + maxsize: int, + block: bool = False, + **pool_kwargs: Any, # Any: Arbitrary keyword arguments passed directly to urllib3's PoolManager constructor. + # Allowed types depend on urllib3 version, but typically include: + # ssl_version (int), cert_reqs (str), ca_certs (str), ca_cert_dir (str), + # ssl_context (ssl.SSLContext), socket_options (list), etc. + # We use Any because the exact set is dynamic and not fully specified in stubs. + ) -> None: ... + def proxy_manager_for( + self, + proxy: str, + **proxy_kwargs: Any # Any: Same as pool_kwargs above, passed to ProxyManager or SOCKSProxyManager. + # May include: ssl_context, cert_reqs, ca_certs, ca_cert_dir, etc. + ) -> Any: # Any: Returns either urllib3.ProxyManager (for HTTP/HTTPS proxies) or SOCKSProxyManager (for SOCKS). + # The exact return type depends on the proxy scheme and is not needed by callers; using Any avoids + # circular imports or complex union types. In practice, the object adheres to a common interface. + ... def cert_verify(self, conn, url, verify, cert): ... def build_response(self, req: PreparedRequest, resp: urllib3.BaseHTTPResponse) -> Response: ... def build_connection_pool_key_attributes( @@ -97,9 +115,16 @@ class HTTPAdapter(BaseAdapter): @deprecated("Use get_connection_with_tls_context() instead.") def get_connection(self, url: _Uri, proxies: Mapping[str, str] | None = None) -> ConnectionPool: ... def close(self) -> None: ... - def request_url(self, request, proxies): ... - def add_headers(self, request, **kwargs): ... - def proxy_headers(self, proxy): ... + def request_url(self, request: PreparedRequest, proxies: Mapping[str, str] | None) -> str: ... + def add_headers( + self, + request: PreparedRequest, + **kwargs: Any # Any: Hook method for subclasses to add custom headers. + # The kwargs mirror the send() parameters: stream (bool), timeout (float|tuple), + # verify (bool|str), cert (str|tuple), proxies (dict). Base implementation ignores them. + # Using Any allows subclasses to access these arguments without repeating the full signature. + ) -> None: ... + def proxy_headers(self, proxy: str) -> dict[str, str]: ... def send( self, request: PreparedRequest, From 5e4f5785cb62a93c5286f35db79b8318910a86f1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 10:02:37 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/requests/requests/adapters.pyi | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index cb921ad19a28..d34484da6107 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -86,20 +86,21 @@ class HTTPAdapter(BaseAdapter): maxsize: int, block: bool = False, **pool_kwargs: Any, # Any: Arbitrary keyword arguments passed directly to urllib3's PoolManager constructor. - # Allowed types depend on urllib3 version, but typically include: - # ssl_version (int), cert_reqs (str), ca_certs (str), ca_cert_dir (str), - # ssl_context (ssl.SSLContext), socket_options (list), etc. - # We use Any because the exact set is dynamic and not fully specified in stubs. + # Allowed types depend on urllib3 version, but typically include: + # ssl_version (int), cert_reqs (str), ca_certs (str), ca_cert_dir (str), + # ssl_context (ssl.SSLContext), socket_options (list), etc. + # We use Any because the exact set is dynamic and not fully specified in stubs. ) -> None: ... def proxy_manager_for( - self, - proxy: str, - **proxy_kwargs: Any # Any: Same as pool_kwargs above, passed to ProxyManager or SOCKSProxyManager. - # May include: ssl_context, cert_reqs, ca_certs, ca_cert_dir, etc. - ) -> Any: # Any: Returns either urllib3.ProxyManager (for HTTP/HTTPS proxies) or SOCKSProxyManager (for SOCKS). - # The exact return type depends on the proxy scheme and is not needed by callers; using Any avoids - # circular imports or complex union types. In practice, the object adheres to a common interface. + self, + proxy: str, + **proxy_kwargs: Any, # Any: Same as pool_kwargs above, passed to ProxyManager or SOCKSProxyManager. + # May include: ssl_context, cert_reqs, ca_certs, ca_cert_dir, etc. + ) -> Any: # Any: Returns either urllib3.ProxyManager (for HTTP/HTTPS proxies) or SOCKSProxyManager (for SOCKS). + # The exact return type depends on the proxy scheme and is not needed by callers; using Any avoids + # circular imports or complex union types. In practice, the object adheres to a common interface. ... + def cert_verify(self, conn, url, verify, cert): ... def build_response(self, req: PreparedRequest, resp: urllib3.BaseHTTPResponse) -> Response: ... def build_connection_pool_key_attributes( @@ -119,10 +120,10 @@ class HTTPAdapter(BaseAdapter): def add_headers( self, request: PreparedRequest, - **kwargs: Any # Any: Hook method for subclasses to add custom headers. - # The kwargs mirror the send() parameters: stream (bool), timeout (float|tuple), - # verify (bool|str), cert (str|tuple), proxies (dict). Base implementation ignores them. - # Using Any allows subclasses to access these arguments without repeating the full signature. + **kwargs: Any, # Any: Hook method for subclasses to add custom headers. + # The kwargs mirror the send() parameters: stream (bool), timeout (float|tuple), + # verify (bool|str), cert (str|tuple), proxies (dict). Base implementation ignores them. + # Using Any allows subclasses to access these arguments without repeating the full signature. ) -> None: ... def proxy_headers(self, proxy: str) -> dict[str, str]: ... def send(