diff --git a/third_party/2and3/werkzeug/datastructures.pyi b/third_party/2and3/werkzeug/datastructures.pyi index 4d5f0ec14..a727df6b7 100644 --- a/third_party/2and3/werkzeug/datastructures.pyi +++ b/third_party/2and3/werkzeug/datastructures.pyi @@ -1,34 +1,52 @@ import collections -from typing import Any, Optional, Mapping, Dict, TypeVar, Callable, Union, overload, Text, Protocol, Iterator, IO -from collections import Container, Iterable, MutableSet +from typing import ( + Any, + Callable, + Container, + Dict, + Generic, + IO, + Iterable, + Iterator, + List, + Mapping, + MutableSet, + NoReturn, + Optional, + Protocol, + Text, + Tuple, + Type, + TypeVar, + Union, + overload, +) _K = TypeVar("_K") _V = TypeVar("_V") _R = TypeVar("_R") _D = TypeVar("_D") -def is_immutable(self): ... +def is_immutable(self) -> NoReturn: ... def iter_multi_items(mapping): ... def native_itermethods(names): ... -class ImmutableListMixin(object): +class ImmutableListMixin(object, Generic[_V]): def __hash__(self) -> int: ... - def __reduce_ex__(self, protocol): ... - def __delitem__(self, key): ... - def __delslice__(self, i, j): ... - def __iadd__(self, other): ... - __imul__: Any - def __setitem__(self, key, value): ... - def __setslice__(self, i, j, value): ... - def append(self, item): ... - remove: Any - def extend(self, iterable): ... - def insert(self, pos, value): ... - def pop(self, index: int = ...): ... - def reverse(self): ... - def sort(self, cmp: Optional[Any] = ..., key: Optional[Any] = ..., reverse: Optional[Any] = ...): ... + 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: ... + def __setitem__(self, key: str, value: Any) -> NoReturn: ... + def append(self, item: Any) -> NoReturn: ... + def remove(self, item: Any) -> NoReturn: ... + def extend(self, iterable: Any) -> NoReturn: ... + def insert(self, pos: int, value: Any) -> NoReturn: ... + def pop(self, index: int = ...) -> NoReturn: ... + def reverse(self) -> NoReturn: ... + def sort(self, cmp: Optional[Any] = ..., key: Optional[Any] = ..., reverse: Optional[Any] = ...) -> NoReturn: ... -class ImmutableList(ImmutableListMixin, list): ... # type: ignore +class ImmutableList(ImmutableListMixin[_V], List[_V]): ... # type: ignore class ImmutableDictMixin(object): @classmethod @@ -243,27 +261,35 @@ class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V def copy(self): ... def __copy__(self): ... -class Accept(ImmutableList): - provided: Any - def __init__(self, values=...): ... - def __getitem__(self, key): ... - def quality(self, key): ... - def __contains__(self, value): ... - def index(self, key): ... - def find(self, key): ... - def values(self): ... - def to_header(self): ... - def best_match(self, matches, default: Optional[Any] = ...): ... +class Accept(ImmutableList[Tuple[str, float]]): + provided: bool + def __init__(self, values: Union[None, Accept, Iterable[Tuple[str, float]]] = ...) -> None: ... + @overload + def __getitem__(self, key: int) -> Tuple[str, float]: ... + @overload + 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: Union[str, Tuple[str, float]]) -> int: ... # type: ignore + def find(self, key: Union[str, Tuple[str, float]]) -> int: ... + def values(self) -> Iterator[str]: ... + def to_header(self) -> str: ... + @overload + def best_match(self, matches: Iterable[str], default: None = ...) -> Optional[str]: ... + @overload + def best_match(self, matches: Iterable[str], default: _D) -> Union[str, _D]: ... @property - def best(self): ... + def best(self) -> Optional[str]: ... class MIMEAccept(Accept): @property - def accept_html(self): ... + def accept_html(self) -> bool: ... @property - def accept_xhtml(self): ... + def accept_xhtml(self) -> bool: ... @property - def accept_json(self): ... + def accept_json(self) -> bool: ... class LanguageAccept(Accept): ... class CharsetAccept(Accept): ... diff --git a/third_party/2and3/werkzeug/http.pyi b/third_party/2and3/werkzeug/http.pyi index e3ca6fe00..bdda6d2cd 100644 --- a/third_party/2and3/werkzeug/http.pyi +++ b/third_party/2and3/werkzeug/http.pyi @@ -46,7 +46,7 @@ def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: @overload def parse_accept_header(value: Optional[Text]) -> Accept: ... @overload -def parse_accept_header(value: Optional[_Str], cls: Callable[[Optional[_Str]], _T]) -> _T: ... +def parse_accept_header(value: Optional[_Str], cls: Callable[[Optional[List[Tuple[str, float]]]], _T]) -> _T: ... @overload def parse_cache_control_header(value: Union[None, bytes, Text], on_update: Optional[Callable[[RequestCacheControl], Any]] = ...) -> RequestCacheControl: ...