mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 08:47:39 +08:00
Add self type to requests.Session.__enter__ (#5620)
Fixes microsoft/pyright#1976
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from _typeshed import SupportsItems
|
||||
from typing import IO, Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, Union
|
||||
from typing import IO, Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, TypeVar, Union
|
||||
|
||||
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils
|
||||
from .models import Response
|
||||
@@ -57,6 +57,7 @@ _Params = Union[
|
||||
Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
|
||||
Union[Text, bytes],
|
||||
]
|
||||
_SessionT = TypeVar("_SessionT", bound=Session)
|
||||
|
||||
class Session(SessionRedirectMixin):
|
||||
__attrs__: Any
|
||||
@@ -74,7 +75,7 @@ class Session(SessionRedirectMixin):
|
||||
adapters: MutableMapping[Any, Any]
|
||||
redirect_cache: RecentlyUsedContainer[Any, Any]
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> Session: ...
|
||||
def __enter__(self: _SessionT) -> _SessionT: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
def prepare_request(self, request): ...
|
||||
def request(
|
||||
|
||||
Reference in New Issue
Block a user