Skip to content

Commit 6873a78

Browse files
requests: Annotate Session.merge_environment_settings (#8313)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 3410571 commit 6873a78

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

stubs/requests/requests/sessions.pyi

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Self, SupportsItems, SupportsRead
22
from collections.abc import Callable, Iterable, Mapping, MutableMapping
33
from typing import IO, Any, Union
4-
from typing_extensions import TypeAlias
4+
from typing_extensions import TypeAlias, TypedDict
55

66
from urllib3._collections import RecentlyUsedContainer
77

@@ -75,6 +75,12 @@ _HeadersUpdateMapping: TypeAlias = Mapping[str, str | bytes | None]
7575
_Timeout: TypeAlias = Union[float, tuple[float, float], tuple[float, None]]
7676
_Verify: TypeAlias = bool | str
7777

78+
class _Settings(TypedDict):
79+
verify: _Verify | None
80+
proxies: _TextMapping
81+
stream: bool
82+
cert: _Cert | None
83+
7884
class Session(SessionRedirectMixin):
7985
__attrs__: Any
8086
headers: CaseInsensitiveDict[str | bytes]
@@ -86,8 +92,8 @@ class Session(SessionRedirectMixin):
8692
hooks: dict[str, list[_Hook] | Any]
8793
params: _Params
8894
stream: bool
89-
verify: None | bool | str
90-
cert: None | str | tuple[str, str]
95+
verify: _Verify | None
96+
cert: _Cert | None
9197
max_redirects: int
9298
trust_env: bool
9399
cookies: RequestsCookieJar
@@ -261,7 +267,14 @@ class Session(SessionRedirectMixin):
261267
allow_redirects: bool = ...,
262268
**kwargs: Any,
263269
) -> Response: ...
264-
def merge_environment_settings(self, url, proxies, stream, verify, cert): ...
270+
def merge_environment_settings(
271+
self,
272+
url: str | bytes | None,
273+
proxies: _TextMapping | None,
274+
stream: bool | None,
275+
verify: _Verify | None,
276+
cert: _Cert | None,
277+
) -> _Settings: ...
265278
def get_adapter(self, url: str) -> _BaseAdapter: ...
266279
def close(self) -> None: ...
267280
def mount(self, prefix: str | bytes, adapter: _BaseAdapter) -> None: ...

0 commit comments

Comments
 (0)