From b35c8f5c26193e5a19951c5606d524a5fabfe75e Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 07:28:03 +0330 Subject: [PATCH 01/10] 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 02/10] 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 3352274ec63257cbc2cee930dee07f5660b20f90 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 08:10:37 +0330 Subject: [PATCH 03/10] Update adapters.pyi --- stubs/requests/requests/adapters.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index a552c0a47053..3bdc1f40f7dd 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -80,8 +80,8 @@ 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) -> None: ... + def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> Any: ... 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 +97,9 @@ 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) -> None: ... + def proxy_headers(self, proxy: str) -> dict[str, str]: ... def send( self, request: PreparedRequest, From b500e977c86ff1a32e6d6f854a3f43cdbe91c518 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 06:29:34 +0000 Subject: [PATCH 04/10] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/requests/requests/adapters.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 3bdc1f40f7dd..164891155972 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -80,7 +80,7 @@ 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: int,maxsize: int,block: bool = False,**pool_kwargs: Any) -> None: ... + def init_poolmanager(self, connections: int, maxsize: int, block: bool = False, **pool_kwargs: Any) -> None: ... def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> Any: ... def cert_verify(self, conn, url, verify, cert): ... def build_response(self, req: PreparedRequest, resp: urllib3.BaseHTTPResponse) -> Response: ... @@ -97,7 +97,7 @@ 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: PreparedRequest,proxies: Mapping[str, str] | None) -> str: ... + def request_url(self, request: PreparedRequest, proxies: Mapping[str, str] | None) -> str: ... def add_headers(self, request: PreparedRequest, **kwargs: Any) -> None: ... def proxy_headers(self, proxy: str) -> dict[str, str]: ... def send( From 2eb217f2f1445579c6fbd7b196b61fa4339a0039 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 10:06:26 +0330 Subject: [PATCH 05/10] Update adapters.pyi --- stubs/requests/requests/adapters.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 164891155972..4c4c437f87c9 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 From 890547e2b5bbf2d502de3509741b7be06629f085 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 06:38:20 +0000 Subject: [PATCH 06/10] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/requests/requests/adapters.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 4c4c437f87c9..7f529e1a520f 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 Any , Literal, TypedDict, type_check_only +from typing import Any, Literal, TypedDict, type_check_only from typing_extensions import NotRequired, deprecated import urllib3 From 1a28c7c37a495192b41640c80a96a4d99b4a62b7 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 13:24:14 +0330 Subject: [PATCH 07/10] Fix type hints in HTTPAdapter stub, add comments for Any --- stubs/requests/requests/adapters.pyi | 33 ++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 7f529e1a520f..f7224fd8fdee 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -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: int, maxsize: int, block: bool = False, **pool_kwargs: Any) -> None: ... - def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> Any: ... + 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( @@ -98,8 +116,15 @@ class HTTPAdapter(BaseAdapter): def get_connection(self, url: _Uri, proxies: Mapping[str, str] | None = None) -> ConnectionPool: ... def close(self) -> None: ... def request_url(self, request: PreparedRequest, proxies: Mapping[str, str] | None) -> str: ... - def add_headers(self, request: PreparedRequest, **kwargs: Any) -> None: ... - def proxy_headers(self, proxy: str) -> dict[str, 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 a6b1d9b9aff0355f097b2b7b20a92a8820161278 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 09:56:06 +0000 Subject: [PATCH 08/10] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/requests/requests/adapters.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index f7224fd8fdee..f3df95db3903 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -92,8 +92,8 @@ class HTTPAdapter(BaseAdapter): # We use Any because the exact set is dynamic and not fully specified in stubs. ) -> None: ... def proxy_manager_for( - self, - proxy: str, + 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). @@ -117,8 +117,8 @@ class HTTPAdapter(BaseAdapter): def close(self) -> None: ... def request_url(self, request: PreparedRequest, proxies: Mapping[str, str] | None) -> str: ... def add_headers( - self, - request: PreparedRequest, + 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. From c5fc0a890df86d4339455d727b156fdaf901500a Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Tue, 12 May 2026 13:38:12 +0330 Subject: [PATCH 09/10] Fix type hints in HTTPAdapter stub, add comments for Any --- stubs/requests/requests/adapters.pyi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index f3df95db3903..cb921ad19a28 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -91,15 +91,15 @@ class HTTPAdapter(BaseAdapter): # 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 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( @@ -124,7 +124,7 @@ class HTTPAdapter(BaseAdapter): # 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 proxy_headers(self, proxy: str) -> dict[str, str]: ... def send( self, request: PreparedRequest, From 0d30724043f9a4bf25ef29a3652e0bf5e95167cf 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:10:08 +0000 Subject: [PATCH 10/10] [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(