Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, Container, Mapping, Text, Tuple
from typing import Any, Container, Mapping, Text
from . import cookies, exceptions, models, structures, utils
from .packages.urllib3 import exceptions as urllib3_exceptions, poolmanager, response
@@ -40,7 +40,7 @@ class BaseAdapter:
self,
request: PreparedRequest,
stream: bool = ...,
timeout: None | float | Tuple[float, float] | Tuple[float, None] = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,
cert: None | bytes | Text | Container[bytes | Text] = ...,
proxies: Mapping[str, str] | None = ...,
@@ -69,7 +69,7 @@ class HTTPAdapter(BaseAdapter):
self,
request: PreparedRequest,
stream: bool = ...,
timeout: None | float | Tuple[float, float] | Tuple[float, None] = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,
cert: None | bytes | Text | Container[bytes | Text] = ...,
proxies: Mapping[str, str] | None = ...,

View File

@@ -63,13 +63,13 @@ _SessionT = TypeVar("_SessionT", bound=Session)
class Session(SessionRedirectMixin):
__attrs__: Any
headers: CaseInsensitiveDict[Text]
auth: None | Tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest]
auth: None | tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest]
proxies: _TextMapping
hooks: _Hooks
params: _Params
stream: bool
verify: None | bool | Text
cert: None | Text | Tuple[Text, Text]
cert: None | Text | tuple[Text, Text]
max_redirects: int
trust_env: bool
cookies: RequestsCookieJar
@@ -88,18 +88,18 @@ class Session(SessionRedirectMixin):
headers: _TextMapping | None = ...,
cookies: None | RequestsCookieJar | _TextMapping = ...,
files: MutableMapping[Text, IO[Any]]
| MutableMapping[Text, Tuple[Text, IO[Any]]]
| MutableMapping[Text, Tuple[Text, IO[Any], Text]]
| MutableMapping[Text, Tuple[Text, IO[Any], Text, _TextMapping]]
| MutableMapping[Text, tuple[Text, IO[Any]]]
| MutableMapping[Text, tuple[Text, IO[Any], Text]]
| MutableMapping[Text, tuple[Text, IO[Any], Text, _TextMapping]]
| None = ...,
auth: None | Tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] = ...,
timeout: None | float | Tuple[float, float] | Tuple[float, None] = ...,
auth: None | tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
allow_redirects: bool | None = ...,
proxies: _TextMapping | None = ...,
hooks: _HooksInput | None = ...,
stream: bool | None = ...,
verify: None | bool | Text = ...,
cert: Text | Tuple[Text, Text] | None = ...,
cert: Text | tuple[Text, Text] | None = ...,
json: Any | None = ...,
) -> Response: ...
def get(

View File

@@ -1,10 +1,10 @@
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Tuple, TypeVar
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar
_VT = TypeVar("_VT")
class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]):
def __init__(self, data: Mapping[str, _VT] | Iterable[Tuple[str, _VT]] | None = ..., **kwargs: _VT) -> None: ...
def lower_items(self) -> Iterator[Tuple[str, _VT]]: ...
def __init__(self, data: Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None = ..., **kwargs: _VT) -> None: ...
def lower_items(self) -> Iterator[tuple[str, _VT]]: ...
def __setitem__(self, key: str, value: _VT) -> None: ...
def __getitem__(self, key: str) -> _VT: ...
def __delitem__(self, key: str) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, AnyStr, Iterable, Mapping, Text, Tuple
from typing import Any, AnyStr, Iterable, Mapping, Text
from . import compat, cookies, exceptions, structures
@@ -51,4 +51,4 @@ def get_auth_from_url(url): ...
def to_native_string(string, encoding=...): ...
def urldefragauth(url): ...
def rewind_body(prepared_request): ...
def check_header_validity(header: Tuple[AnyStr, AnyStr]) -> None: ...
def check_header_validity(header: tuple[AnyStr, AnyStr]) -> None: ...