Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-14 17:18:19 -07:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions
+6 -6
View File
@@ -36,7 +36,7 @@ def native_itermethods(names): ...
class ImmutableListMixin(Generic[_V]):
def __hash__(self) -> int: ...
def __reduce_ex__(self: _D, protocol) -> Tuple[Type[_D], list[_V]]: ...
def __reduce_ex__(self: _D, protocol) -> tuple[Type[_D], list[_V]]: ...
def __delitem__(self, key: _V) -> NoReturn: ...
def __iadd__(self, other: Any) -> NoReturn: ...
def __imul__(self, other: Any) -> NoReturn: ...
@@ -280,17 +280,17 @@ class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V
class Accept(ImmutableList[Tuple[str, float]]):
provided: bool
def __init__(self, values: None | Accept | Iterable[Tuple[str, float]] = ...) -> None: ...
def __init__(self, values: None | Accept | Iterable[tuple[str, float]] = ...) -> None: ...
@overload
def __getitem__(self, key: SupportsIndex) -> Tuple[str, float]: ...
def __getitem__(self, key: SupportsIndex) -> tuple[str, float]: ...
@overload
def __getitem__(self, s: slice) -> list[Tuple[str, float]]: ...
def __getitem__(self, s: slice) -> list[tuple[str, float]]: ...
@overload
def __getitem__(self, key: str) -> float: ...
def quality(self, key: str) -> float: ...
def __contains__(self, value: str) -> bool: ... # type: ignore
def index(self, key: str | Tuple[str, float]) -> int: ... # type: ignore
def find(self, key: str | Tuple[str, float]) -> int: ...
def index(self, key: str | tuple[str, float]) -> int: ... # type: ignore
def find(self, key: str | tuple[str, float]) -> int: ...
def values(self) -> Iterator[str]: ...
def to_header(self) -> str: ...
@overload
+1 -1
View File
@@ -19,7 +19,7 @@ class HTTPException(Exception):
def name(self) -> str: ...
def get_description(self, environ: WSGIEnvironment | None = ...) -> Text: ...
def get_body(self, environ: WSGIEnvironment | None = ...) -> Text: ...
def get_headers(self, environ: WSGIEnvironment | None = ...) -> list[Tuple[str, str]]: ...
def get_headers(self, environ: WSGIEnvironment | None = ...) -> list[tuple[str, str]]: ...
def get_response(self, environ: WSGIEnvironment | _EnvironContainer | None = ...) -> Response: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
+7 -7
View File
@@ -25,7 +25,7 @@ def parse_form_data(
max_content_length: int | None = ...,
cls: Callable[[], _Dict] | None = ...,
silent: bool = ...,
) -> Tuple[IO[bytes], _Dict, _Dict]: ...
) -> tuple[IO[bytes], _Dict, _Dict]: ...
def exhaust_stream(f: _F) -> _F: ...
class FormDataParser(object):
@@ -47,10 +47,10 @@ class FormDataParser(object):
silent: bool = ...,
) -> None: ...
def get_parse_func(self, mimetype: str, options: Any) -> _ParseFunc | None: ...
def parse_from_environ(self, environ: WSGIEnvironment) -> Tuple[IO[bytes], _Dict, _Dict]: ...
def parse_from_environ(self, environ: WSGIEnvironment) -> tuple[IO[bytes], _Dict, _Dict]: ...
def parse(
self, stream: IO[bytes], mimetype: Text, content_length: int | None, options: Mapping[str, str] | None = ...
) -> Tuple[IO[bytes], _Dict, _Dict]: ...
) -> tuple[IO[bytes], _Dict, _Dict]: ...
parse_functions: dict[Text, _ParseFunc]
def is_valid_multipart_boundary(boundary: str) -> bool: ...
@@ -77,11 +77,11 @@ class MultiPartParser(object):
def get_part_charset(self, headers: Mapping[str, str]) -> Text: ...
def start_file_streaming(
self, filename: Text | bytes, headers: Mapping[str, str], total_content_length: int | None
) -> Tuple[Text, IO[bytes]]: ...
) -> tuple[Text, IO[bytes]]: ...
def in_memory_threshold_reached(self, bytes: Any) -> NoReturn: ...
def validate_boundary(self, boundary: str | None) -> None: ...
def parse_lines(
self, file: Any, boundary: bytes, content_length: int, cap_at_buffer: bool = ...
) -> Generator[Tuple[str, Any], None, None]: ...
def parse_parts(self, file: Any, boundary: bytes, content_length: int) -> Generator[Tuple[str, Any], None, None]: ...
def parse(self, file: Any, boundary: bytes, content_length: int) -> Tuple[_Dict, _Dict]: ...
) -> Generator[tuple[str, Any], None, None]: ...
def parse_parts(self, file: Any, boundary: bytes, content_length: int) -> Generator[tuple[str, Any], None, None]: ...
def parse(self, file: Any, boundary: bytes, content_length: int) -> tuple[_Dict, _Dict]: ...
+7 -7
View File
@@ -43,9 +43,9 @@ def parse_dict_header(value: bytes | Text) -> dict[Text, Text | None]: ...
@overload
def parse_dict_header(value: bytes | Text, cls: Type[_T]) -> _T: ...
@overload
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, dict[str, str | None]]: ...
def parse_options_header(value: None, multiple: bool = ...) -> tuple[str, dict[str, str | None]]: ...
@overload
def parse_options_header(value: _Str) -> Tuple[_Str, dict[_Str, _Str | None]]: ...
def parse_options_header(value: _Str) -> tuple[_Str, dict[_Str, _Str | None]]: ...
# actually returns Tuple[_Str, dict[_Str, _Str | None], ...]
@overload
@@ -53,7 +53,7 @@ def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]:
@overload
def parse_accept_header(value: Text | None) -> Accept: ...
@overload
def parse_accept_header(value: _Str | None, cls: Callable[[list[Tuple[str, float]] | None], _T]) -> _T: ...
def parse_accept_header(value: _Str | None, cls: Callable[[list[tuple[str, float]] | None], _T]) -> _T: ...
@overload
def parse_cache_control_header(
value: None | bytes | Text, on_update: Callable[[RequestCacheControl], Any] | None = ...
@@ -75,7 +75,7 @@ def parse_content_range_header(
value: Text | None, on_update: Callable[[ContentRange], Any] | None = ...
) -> ContentRange | None: ...
def quote_etag(etag: _Str, weak: bool = ...) -> _Str: ...
def unquote_etag(etag: _Str | None) -> Tuple[_Str | None, _Str | None]: ...
def unquote_etag(etag: _Str | None) -> tuple[_Str | None, _Str | None]: ...
def parse_etags(value: Text | None) -> ETags: ...
def generate_etag(data: _ETagData) -> str: ...
def parse_date(value: str | None) -> datetime | None: ...
@@ -90,8 +90,8 @@ def is_resource_modified(
last_modified: None | Text | datetime = ...,
ignore_if_range: bool = ...,
) -> bool: ...
def remove_entity_headers(headers: list[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
def remove_hop_by_hop_headers(headers: list[Tuple[Text, Text]] | Headers) -> None: ...
def remove_entity_headers(headers: list[tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
def remove_hop_by_hop_headers(headers: list[tuple[Text, Text]] | Headers) -> None: ...
def is_entity_header(header: Text) -> bool: ...
def is_hop_by_hop_header(header: Text) -> bool: ...
@overload
@@ -103,7 +103,7 @@ def parse_cookie(
header: None | WSGIEnvironment | Text | bytes,
charset: Text = ...,
errors: Text = ...,
cls: Callable[[Iterable[Tuple[Text, Text]]], _T] | None = ...,
cls: Callable[[Iterable[tuple[Text, Text]]], _T] | None = ...,
) -> _T: ...
def dump_cookie(
key: _ToBytes,
+2 -2
View File
@@ -55,8 +55,8 @@ class LintMiddleware(object):
def __init__(self, app: WSGIApplication) -> None: ...
def check_environ(self, environ: WSGIEnvironment) -> None: ...
def check_start_response(
self, status: str, headers: list[Tuple[str, str]], exc_info: Tuple[Any, ...] | None
) -> Tuple[int, Headers]: ...
self, status: str, headers: list[tuple[str, str]], exc_info: Tuple[Any, ...] | None
) -> tuple[int, Headers]: ...
def check_headers(self, headers: Mapping[str, str]) -> None: ...
def check_iterator(self, app_iter: Iterable[bytes]) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> GuardedIterator: ...
@@ -1,12 +1,12 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Iterable, Text, Tuple
from typing import IO, Iterable, Text
class ProfilerMiddleware(object):
def __init__(
self,
app: WSGIApplication,
stream: IO[str] = ...,
sort_by: Tuple[Text, Text] = ...,
sort_by: tuple[Text, Text] = ...,
restrictions: Iterable[str | float] = ...,
profile_dir: Text | None = ...,
filename_format: Text = ...,
@@ -9,13 +9,13 @@ _Loader = Callable[[Optional[Text]], Union[Tuple[None, None], Tuple[Text, _Opene
class SharedDataMiddleware(object):
app: WSGIApplication
exports: list[Tuple[Text, _Loader]]
exports: list[tuple[Text, _Loader]]
cache: bool
cache_timeout: float
def __init__(
self,
app: WSGIApplication,
exports: Mapping[Text, _V] | Iterable[Tuple[Text, _V]],
exports: Mapping[Text, _V] | Iterable[tuple[Text, _V]],
disallow: Text | None = ...,
cache: bool = ...,
cache_timeout: float = ...,
+10 -10
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Text, Tuple, Type, TypeVar, overload
from typing import Any, Generic, Text, Type, TypeVar, overload
from typing_extensions import Literal
if sys.version_info >= (3, 0):
@@ -111,55 +111,55 @@ class Client(Generic[_R]):
def run_wsgi_app(self, environ, buffered: bool = ...): ...
def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ...
@overload
def open(self, *args, as_tuple: Literal[True], **kwargs) -> Tuple[WSGIEnvironment, _R]: ...
def open(self, *args, as_tuple: Literal[True], **kwargs) -> tuple[WSGIEnvironment, _R]: ...
@overload
def open(self, *args, as_tuple: Literal[False] = ..., **kwargs) -> _R: ...
@overload
def open(self, *args, as_tuple: bool, **kwargs) -> Any: ...
@overload
def get(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def get(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def get(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def get(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def patch(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def patch(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def patch(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def patch(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def post(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def post(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def post(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def post(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def head(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def head(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def head(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def head(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def put(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def put(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def put(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def put(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def delete(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def delete(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def delete(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def delete(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def options(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def options(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def options(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def options(self, *args, as_tuple: bool, **kw) -> Any: ...
@overload
def trace(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ...
def trace(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
@overload
def trace(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
+2 -2
View File
@@ -1,6 +1,6 @@
from _typeshed.wsgi import InputStream, WSGIEnvironment
from datetime import datetime, timedelta
from typing import Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence, Text, Tuple, Type, TypeVar, overload
from typing import Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence, Text, Type, TypeVar, overload
from typing_extensions import Literal
from .datastructures import (
@@ -108,7 +108,7 @@ class BaseResponse:
self,
response: str | bytes | bytearray | Iterable[str] | Iterable[bytes] | None = ...,
status: Text | int | None = ...,
headers: Headers | Mapping[Text, Text] | Sequence[Tuple[Text, Text]] | None = ...,
headers: Headers | Mapping[Text, Text] | Sequence[tuple[Text, Text]] | None = ...,
mimetype: Text | None = ...,
content_type: Text | None = ...,
direct_passthrough: bool = ...,