Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,5 +1,5 @@
from _typeshed import SupportsItems
from typing import IO, Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, TypeVar, Union
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, Optional, Text, TypeVar, Union
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils
from .models import Response
@@ -43,18 +43,18 @@ class SessionRedirectMixin:
def rebuild_proxies(self, prepared_request, proxies): ...
def should_strip_auth(self, old_url, new_url): ...
_Data = Union[None, Text, bytes, Mapping[str, Any], Mapping[Text, Any], Iterable[Tuple[Text, Optional[Text]]], IO[Any]]
_Data = Union[None, Text, bytes, Mapping[str, Any], Mapping[Text, Any], Iterable[tuple[Text, Optional[Text]]], IO[Any]]
_Hook = Callable[[Response], Any]
_Hooks = MutableMapping[Text, List[_Hook]]
_Hooks = MutableMapping[Text, list[_Hook]]
_HooksInput = MutableMapping[Text, Union[Iterable[_Hook], _Hook]]
_ParamsMappingKeyType = Union[Text, bytes, int, float]
_ParamsMappingValueType = Union[Text, bytes, int, float, Iterable[Union[Text, bytes, int, float]], None]
_Params = Union[
SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType],
Tuple[_ParamsMappingKeyType, _ParamsMappingValueType],
Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
tuple[_ParamsMappingKeyType, _ParamsMappingValueType],
Iterable[tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
Union[Text, bytes],
]
_TextMapping = MutableMapping[Text, Text]

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar
from typing import Any, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar
_VT = TypeVar("_VT")
@@ -12,7 +12,7 @@ class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]):
def __len__(self) -> int: ...
def copy(self) -> CaseInsensitiveDict[_VT]: ...
class LookupDict(Dict[str, _VT]):
class LookupDict(dict[str, _VT]):
name: Any
def __init__(self, name: Any = ...) -> None: ...
def __getitem__(self, key: str) -> _VT | None: ... # type: ignore[override]