Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 11:05:21 +02:00
1 parent b9adb7a874
commit ee487304d7
578 files changed
+8080 -8966

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Optional, Text
from typing import Any, Text
if sys.version_info >= (3,):
from io import BytesIO as BytesIO, StringIO as StringIO
@@ -44,7 +44,7 @@ def wsgi_decoding_dance(s, charset: Text = ..., errors: Text = ...): ...
def wsgi_encoding_dance(s, charset: Text = ..., errors: Text = ...): ...
def to_bytes(x, charset: Text = ..., errors: Text = ...): ...
def to_native(x, charset: Text = ..., errors: Text = ...): ...
def reraise(tp, value, tb: Optional[Any] = ...): ...
def reraise(tp, value, tb: Any | None = ...): ...
imap: Any
izip: Any
+8 -8
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
class _Missing:
def __reduce__(self): ...
@@ -13,14 +13,14 @@ class _DictAccessorProperty:
def __init__(
self,
name,
default: Optional[Any] = ...,
load_func: Optional[Any] = ...,
dump_func: Optional[Any] = ...,
read_only: Optional[Any] = ...,
doc: Optional[Any] = ...,
default: Any | None = ...,
load_func: Any | None = ...,
dump_func: Any | None = ...,
read_only: Any | None = ...,
doc: Any | None = ...,
): ...
def __get__(self, obj, type: Optional[Any] = ...): ...
def __get__(self, obj, type: Any | None = ...): ...
def __set__(self, obj, value): ...
def __delete__(self, obj): ...
def _easteregg(app: Optional[Any] = ...): ...
def _easteregg(app: Any | None = ...): ...
+3 -3
View File
@@ -1,10 +1,10 @@
from typing import Any, Optional
from typing import Any
class ReloaderLoop:
name: Any
extra_files: Any
interval: float
def __init__(self, extra_files: Optional[Any] = ..., interval: float = ...): ...
def __init__(self, extra_files: Any | None = ..., interval: float = ...): ...
def run(self): ...
def restart_with_reloader(self): ...
def trigger_reload(self, filename): ...
@@ -26,4 +26,4 @@ class WatchdogReloaderLoop(ReloaderLoop):
reloader_loops: Any
def run_with_reloader(main_func, extra_files: Optional[Any] = ..., interval: float = ..., reloader_type: str = ...): ...
def run_with_reloader(main_func, extra_files: Any | None = ..., interval: float = ..., reloader_type: str = ...): ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
XHTML_NAMESPACE: Any
@@ -22,7 +22,7 @@ class AtomFeed:
generator: Any
links: Any
entries: Any
def __init__(self, title: Optional[Any] = ..., entries: Optional[Any] = ..., **kwargs): ...
def __init__(self, title: Any | None = ..., entries: Any | None = ..., **kwargs): ...
def add(self, *args, **kwargs): ...
def generate(self): ...
def to_string(self): ...
@@ -45,6 +45,6 @@ class FeedEntry:
links: Any
categories: Any
xml_base: Any
def __init__(self, title: Optional[Any] = ..., content: Optional[Any] = ..., feed_url: Optional[Any] = ..., **kwargs): ...
def __init__(self, title: Any | None = ..., content: Any | None = ..., feed_url: Any | None = ..., **kwargs): ...
def generate(self): ...
def to_string(self): ...
+19 -19
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
class BaseCache:
default_timeout: float
@@ -7,9 +7,9 @@ class BaseCache:
def delete(self, key): ...
def get_many(self, *keys): ...
def get_dict(self, *keys): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set_many(self, mapping, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def set_many(self, mapping, timeout: float | None = ...): ...
def delete_many(self, *keys): ...
def has(self, key): ...
def clear(self): ...
@@ -22,20 +22,20 @@ class SimpleCache(BaseCache):
clear: Any
def __init__(self, threshold: int = ..., default_timeout: float = ...): ...
def get(self, key): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def delete(self, key): ...
def has(self, key): ...
class MemcachedCache(BaseCache):
key_prefix: Any
def __init__(self, servers: Optional[Any] = ..., default_timeout: float = ..., key_prefix: Optional[Any] = ...): ...
def __init__(self, servers: Any | None = ..., default_timeout: float = ..., key_prefix: Any | None = ...): ...
def get(self, key): ...
def get_dict(self, *keys): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def get_many(self, *keys): ...
def set_many(self, mapping, timeout: Optional[float] = ...): ...
def set_many(self, mapping, timeout: float | None = ...): ...
def delete(self, key): ...
def delete_many(self, *keys): ...
def has(self, key): ...
@@ -52,19 +52,19 @@ class RedisCache(BaseCache):
self,
host: str = ...,
port: int = ...,
password: Optional[Any] = ...,
password: Any | None = ...,
db: int = ...,
default_timeout: float = ...,
key_prefix: Optional[Any] = ...,
key_prefix: Any | None = ...,
**kwargs,
): ...
def dump_object(self, value): ...
def load_object(self, value): ...
def get(self, key): ...
def get_many(self, *keys): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set_many(self, mapping, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def set_many(self, mapping, timeout: float | None = ...): ...
def delete(self, key): ...
def delete_many(self, *keys): ...
def has(self, key): ...
@@ -76,8 +76,8 @@ class FileSystemCache(BaseCache):
def __init__(self, cache_dir, threshold: int = ..., default_timeout: float = ..., mode: int = ...): ...
def clear(self): ...
def get(self, key): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def delete(self, key): ...
def has(self, key): ...
@@ -86,7 +86,7 @@ class UWSGICache(BaseCache):
def __init__(self, default_timeout: float = ..., cache: str = ...): ...
def get(self, key): ...
def delete(self, key): ...
def set(self, key, value, timeout: Optional[float] = ...): ...
def add(self, key, value, timeout: Optional[float] = ...): ...
def set(self, key, value, timeout: float | None = ...): ...
def add(self, key, value, timeout: float | None = ...): ...
def clear(self): ...
def has(self, key): ...
+3 -3
View File
@@ -1,5 +1,5 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, List, Mapping, Optional, Set, Text
from typing import Any, Iterable, List, Mapping, Set, Text
from ..middleware.proxy_fix import ProxyFix as ProxyFix
@@ -21,7 +21,7 @@ class HeaderRewriterFix(object):
remove_headers: Set[Text]
add_headers: List[Text]
def __init__(
self, app: WSGIApplication, remove_headers: Optional[Iterable[Text]] = ..., add_headers: Optional[Iterable[Text]] = ...
self, app: WSGIApplication, remove_headers: Iterable[Text] | None = ..., add_headers: Iterable[Text] | None = ...
) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -30,6 +30,6 @@ class InternetExplorerFix(object):
fix_vary: bool
fix_attach: bool
def __init__(self, app: WSGIApplication, fix_vary: bool = ..., fix_attach: bool = ...) -> None: ...
def fix_headers(self, environ: WSGIEnvironment, headers: Mapping[str, str], status: Optional[Any] = ...) -> None: ...
def fix_headers(self, environ: WSGIEnvironment, headers: Mapping[str, str], status: Any | None = ...) -> None: ...
def run_fixed(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
+7 -7
View File
@@ -1,25 +1,25 @@
from typing import Any, Optional, Text, Union
from typing import Any, Text
greenlet: Any
class IterIO:
def __new__(cls, obj, sentinel: Union[Text, bytes] = ...): ...
def __new__(cls, obj, sentinel: Text | bytes = ...): ...
def __iter__(self): ...
def tell(self): ...
def isatty(self): ...
def seek(self, pos, mode: int = ...): ...
def truncate(self, size: Optional[Any] = ...): ...
def truncate(self, size: Any | None = ...): ...
def write(self, s): ...
def writelines(self, list): ...
def read(self, n: int = ...): ...
def readlines(self, sizehint: int = ...): ...
def readline(self, length: Optional[Any] = ...): ...
def readline(self, length: Any | None = ...): ...
def flush(self): ...
def __next__(self): ...
class IterI(IterIO):
sentinel: Any
def __new__(cls, func, sentinel: Union[Text, bytes] = ...): ...
def __new__(cls, func, sentinel: Text | bytes = ...): ...
closed: Any
def close(self): ...
def write(self, s): ...
@@ -30,10 +30,10 @@ class IterO(IterIO):
sentinel: Any
closed: Any
pos: Any
def __new__(cls, gen, sentinel: Union[Text, bytes] = ...): ...
def __new__(cls, gen, sentinel: Text | bytes = ...): ...
def __iter__(self): ...
def close(self): ...
def seek(self, pos, mode: int = ...): ...
def read(self, n: int = ...): ...
def readline(self, length: Optional[Any] = ...): ...
def readline(self, length: Any | None = ...): ...
def readlines(self, sizehint: int = ...): ...
@@ -1,6 +1,6 @@
from hashlib import sha1 as _default_hash
from hmac import new as hmac
from typing import Any, Optional
from typing import Any
from werkzeug.contrib.sessions import ModificationTrackingDict
@@ -12,28 +12,28 @@ class SecureCookie(ModificationTrackingDict[Any, Any]):
quote_base64: Any
secret_key: Any
new: Any
def __init__(self, data: Optional[Any] = ..., secret_key: Optional[Any] = ..., new: bool = ...): ...
def __init__(self, data: Any | None = ..., secret_key: Any | None = ..., new: bool = ...): ...
@property
def should_save(self): ...
@classmethod
def quote(cls, value): ...
@classmethod
def unquote(cls, value): ...
def serialize(self, expires: Optional[Any] = ...): ...
def serialize(self, expires: Any | None = ...): ...
@classmethod
def unserialize(cls, string, secret_key): ...
@classmethod
def load_cookie(cls, request, key: str = ..., secret_key: Optional[Any] = ...): ...
def load_cookie(cls, request, key: str = ..., secret_key: Any | None = ...): ...
def save_cookie(
self,
response,
key: str = ...,
expires: Optional[Any] = ...,
session_expires: Optional[Any] = ...,
max_age: Optional[Any] = ...,
expires: Any | None = ...,
session_expires: Any | None = ...,
max_age: Any | None = ...,
path: str = ...,
domain: Optional[Any] = ...,
secure: Optional[Any] = ...,
domain: Any | None = ...,
secure: Any | None = ...,
httponly: bool = ...,
force: bool = ...,
): ...
+10 -10
View File
@@ -1,11 +1,11 @@
from typing import Any, Optional, Text, TypeVar
from typing import Any, Text, TypeVar
from werkzeug.datastructures import CallbackDict
_K = TypeVar("_K")
_V = TypeVar("_V")
def generate_key(salt: Optional[Any] = ...): ...
def generate_key(salt: Any | None = ...): ...
class ModificationTrackingDict(CallbackDict[_K, _V]):
modified: Any
@@ -22,9 +22,9 @@ class Session(ModificationTrackingDict[_K, _V]):
class SessionStore:
session_class: Any
def __init__(self, session_class: Optional[Any] = ...): ...
def __init__(self, session_class: Any | None = ...): ...
def is_valid_key(self, key): ...
def generate_key(self, salt: Optional[Any] = ...): ...
def generate_key(self, salt: Any | None = ...): ...
def new(self): ...
def save(self, session): ...
def save_if_modified(self, session): ...
@@ -38,9 +38,9 @@ class FilesystemSessionStore(SessionStore):
mode: Any
def __init__(
self,
path: Optional[Any] = ...,
path: Any | None = ...,
filename_template: Text = ...,
session_class: Optional[Any] = ...,
session_class: Any | None = ...,
renew_missing: bool = ...,
mode: int = ...,
): ...
@@ -66,11 +66,11 @@ class SessionMiddleware:
app,
store,
cookie_name: str = ...,
cookie_age: Optional[Any] = ...,
cookie_expires: Optional[Any] = ...,
cookie_age: Any | None = ...,
cookie_expires: Any | None = ...,
cookie_path: str = ...,
cookie_domain: Optional[Any] = ...,
cookie_secure: Optional[Any] = ...,
cookie_domain: Any | None = ...,
cookie_secure: Any | None = ...,
cookie_httponly: bool = ...,
environ_key: str = ...,
): ...
+72 -76
View File
@@ -13,12 +13,10 @@ from typing import (
Mapping,
MutableSet,
NoReturn,
Optional,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
@@ -49,7 +47,7 @@ class ImmutableListMixin(Generic[_V]):
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: ...
def sort(self, cmp: Any | None = ..., key: Any | None = ..., reverse: Any | None = ...) -> NoReturn: ...
class ImmutableList(ImmutableListMixin[_V], List[_V]): ... # type: ignore
@@ -58,9 +56,9 @@ class ImmutableDictMixin(object):
def fromkeys(cls, *args, **kwargs): ...
def __reduce_ex__(self, protocol): ...
def __hash__(self) -> int: ...
def setdefault(self, key, default: Optional[Any] = ...): ...
def setdefault(self, key, default: Any | None = ...): ...
def update(self, *args, **kwargs): ...
def pop(self, key, default: Optional[Any] = ...): ...
def pop(self, key, default: Any | None = ...): ...
def popitem(self): ...
def __setitem__(self, key, value): ...
def __delitem__(self, key): ...
@@ -72,11 +70,11 @@ class ImmutableMultiDictMixin(ImmutableDictMixin):
def popitemlist(self): ...
def poplist(self, key): ...
def setlist(self, key, new_list): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
def setlistdefault(self, key, default_list: Any | None = ...): ...
class UpdateDictMixin(object):
on_update: Any
def setdefault(self, key, default: Optional[Any] = ...): ...
def setdefault(self, key, default: Any | None = ...): ...
def pop(self, key, default=...): ...
__setitem__: Any
__delitem__: Any
@@ -86,13 +84,13 @@ class UpdateDictMixin(object):
class TypeConversionDict(Dict[_K, _V]):
@overload
def get(self, key: _K, *, type: None = ...) -> Optional[_V]: ...
def get(self, key: _K, *, type: None = ...) -> _V | None: ...
@overload
def get(self, key: _K, default: _D, type: None = ...) -> Union[_V, _D]: ...
def get(self, key: _K, default: _D, type: None = ...) -> _V | _D: ...
@overload
def get(self, key: _K, *, type: Callable[[_V], _R]) -> Optional[_R]: ...
def get(self, key: _K, *, type: Callable[[_V], _R]) -> _R | None: ...
@overload
def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> Union[_R, _D]: ...
def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> _R | _D: ...
class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore
def copy(self) -> TypeConversionDict[_K, _V]: ...
@@ -103,14 +101,14 @@ class ViewItems:
def __iter__(self): ...
class MultiDict(TypeConversionDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __init__(self, mapping: Any | None = ...): ...
def __getitem__(self, key): ...
def __setitem__(self, key, value): ...
def add(self, key, value): ...
def getlist(self, key, type: Optional[Any] = ...): ...
def getlist(self, key, type: Any | None = ...): ...
def setlist(self, key, new_list): ...
def setdefault(self, key, default: Optional[Any] = ...): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
def setdefault(self, key, default: Any | None = ...): ...
def setlistdefault(self, key, default_list: Any | None = ...): ...
def items(self, multi: bool = ...): ...
def lists(self): ...
def keys(self): ...
@@ -118,7 +116,7 @@ class MultiDict(TypeConversionDict[_K, _V]):
def values(self): ...
def listvalues(self): ...
def copy(self): ...
def deepcopy(self, memo: Optional[Any] = ...): ...
def deepcopy(self, memo: Any | None = ...): ...
def to_dict(self, flat: bool = ...): ...
def update(self, other_dict): ...
def pop(self, key, default=...): ...
@@ -137,7 +135,7 @@ class _omd_bucket:
def unlink(self, omd): ...
class OrderedMultiDict(MultiDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __init__(self, mapping: Any | None = ...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __reduce_ex__(self, protocol): ...
@@ -151,9 +149,9 @@ class OrderedMultiDict(MultiDict[_K, _V]):
def lists(self): ...
def listvalues(self): ...
def add(self, key, value): ...
def getlist(self, key, type: Optional[Any] = ...): ...
def getlist(self, key, type: Any | None = ...): ...
def setlist(self, key, new_list): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
def setlistdefault(self, key, default_list: Any | None = ...): ...
def update(self, mapping): ...
def poplist(self, key): ...
def pop(self, key, default=...): ...
@@ -161,29 +159,29 @@ class OrderedMultiDict(MultiDict[_K, _V]):
def popitemlist(self): ...
class Headers(object):
def __init__(self, defaults: Optional[Any] = ...): ...
def __init__(self, defaults: Any | None = ...): ...
def __getitem__(self, key, _get_mode: bool = ...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
@overload
def get(self, key: str, *, type: None = ...) -> Optional[str]: ...
def get(self, key: str, *, type: None = ...) -> str | None: ...
@overload
def get(self, key: str, default: _D, type: None = ...) -> Union[str, _D]: ...
def get(self, key: str, default: _D, type: None = ...) -> str | _D: ...
@overload
def get(self, key: str, *, type: Callable[[str], _R]) -> Optional[_R]: ...
def get(self, key: str, *, type: Callable[[str], _R]) -> _R | None: ...
@overload
def get(self, key: str, default: _D, type: Callable[[str], _R]) -> Union[_R, _D]: ...
def get(self, key: str, default: _D, type: Callable[[str], _R]) -> _R | _D: ...
@overload
def get(self, key: str, *, as_bytes: bool) -> Any: ...
@overload
def get(self, key: str, *, type: None, as_bytes: bool) -> Any: ...
@overload
def get(self, key: str, *, type: Callable[[Any], _R], as_bytes: bool) -> Optional[_R]: ...
def get(self, key: str, *, type: Callable[[Any], _R], as_bytes: bool) -> _R | None: ...
@overload
def get(self, key: str, default: Any, type: None, as_bytes: bool) -> Any: ...
@overload
def get(self, key: str, default: _D, type: Callable[[Any], _R], as_bytes: bool) -> Union[_R, _D]: ...
def getlist(self, key, type: Optional[Any] = ..., as_bytes: bool = ...): ...
def get(self, key: str, default: _D, type: Callable[[Any], _R], as_bytes: bool) -> _R | _D: ...
def getlist(self, key, type: Any | None = ..., as_bytes: bool = ...): ...
def get_all(self, name): ...
def items(self, lower: bool = ...): ...
def keys(self, lower: bool = ...): ...
@@ -192,13 +190,13 @@ class Headers(object):
def __delitem__(self, key: Any) -> None: ...
def remove(self, key): ...
@overload
def pop(self, key: Optional[int] = ...) -> str: ... # default is ignored, using it is an error
def pop(self, key: int | None = ...) -> str: ... # default is ignored, using it is an error
@overload
def pop(self, key: str) -> str: ...
@overload
def pop(self, key: str, default: str) -> str: ...
@overload
def pop(self, key: str, default: None) -> Optional[str]: ...
def pop(self, key: str, default: None) -> str | None: ...
def popitem(self): ...
def __contains__(self, key): ...
has_key: Any
@@ -225,13 +223,13 @@ class ImmutableHeadersMixin:
def extend(self, iterable): ...
def insert(self, pos, value): ...
@overload
def pop(self, key: Optional[int] = ...) -> str: ... # default is ignored, using it is an error
def pop(self, key: int | None = ...) -> str: ... # default is ignored, using it is an error
@overload
def pop(self, key: str) -> str: ...
@overload
def pop(self, key: str, default: str) -> str: ...
@overload
def pop(self, key: str, default: None) -> Optional[str]: ...
def pop(self, key: str, default: None) -> str | None: ...
def popitem(self): ...
def setdefault(self, key, default): ...
@@ -247,12 +245,12 @@ class EnvironHeaders(ImmutableHeadersMixin, Headers):
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore
def __reduce_ex__(self, protocol): ...
dicts: Any
def __init__(self, dicts: Optional[Any] = ...): ...
def __init__(self, dicts: Any | None = ...): ...
@classmethod
def fromkeys(cls): ...
def __getitem__(self, key): ...
def get(self, key, default: Optional[Any] = ..., type: Optional[Any] = ...): ...
def getlist(self, key, type: Optional[Any] = ...): ...
def get(self, key, default: Any | None = ..., type: Any | None = ...): ...
def getlist(self, key, type: Any | None = ...): ...
def keys(self): ...
__iter__: Any
def items(self, multi: bool = ...): ...
@@ -266,7 +264,7 @@ class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ig
has_key: Any
class FileMultiDict(MultiDict[_K, _V]):
def add_file(self, name, file, filename: Optional[Any] = ..., content_type: Optional[Any] = ...): ...
def add_file(self, name, file, filename: Any | None = ..., content_type: Any | None = ...): ...
class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore
def copy(self): ...
@@ -282,7 +280,7 @@ class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V
class Accept(ImmutableList[Tuple[str, float]]):
provided: bool
def __init__(self, values: Union[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]: ...
@overload
@@ -291,16 +289,16 @@ class Accept(ImmutableList[Tuple[str, float]]):
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 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
def best_match(self, matches: Iterable[str], default: None = ...) -> Optional[str]: ...
def best_match(self, matches: Iterable[str], default: None = ...) -> str | None: ...
@overload
def best_match(self, matches: Iterable[str], default: _D) -> Union[str, _D]: ...
def best_match(self, matches: Iterable[str], default: _D) -> str | _D: ...
@property
def best(self) -> Optional[str]: ...
def best(self) -> str | None: ...
class MIMEAccept(Accept):
@property
@@ -322,7 +320,7 @@ class _CacheControl(UpdateDictMixin, Dict[str, Any]):
no_transform: Any
on_update: Any
provided: Any
def __init__(self, values=..., on_update: Optional[Any] = ...): ...
def __init__(self, values=..., on_update: Any | None = ...): ...
def to_header(self): ...
class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore
@@ -340,11 +338,11 @@ class ResponseCacheControl(_CacheControl):
class CallbackDict(UpdateDictMixin, Dict[_K, _V]):
on_update: Any
def __init__(self, initial: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def __init__(self, initial: Any | None = ..., on_update: Any | None = ...): ...
class HeaderSet(MutableSet[str]):
on_update: Any
def __init__(self, headers: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def __init__(self, headers: Any | None = ..., on_update: Any | None = ...): ...
def add(self, header): ...
def remove(self, header): ...
def update(self, iterable): ...
@@ -364,14 +362,14 @@ class HeaderSet(MutableSet[str]):
class ETags(Container[str], Iterable[str]):
star_tag: Any
def __init__(self, strong_etags: Optional[Any] = ..., weak_etags: Optional[Any] = ..., star_tag: bool = ...): ...
def __init__(self, strong_etags: Any | None = ..., weak_etags: Any | None = ..., star_tag: bool = ...): ...
def as_set(self, include_weak: bool = ...): ...
def is_weak(self, etag): ...
def contains_weak(self, etag): ...
def contains(self, etag): ...
def contains_raw(self, etag): ...
def to_header(self): ...
def __call__(self, etag: Optional[Any] = ..., data: Optional[Any] = ..., include_weak: bool = ...): ...
def __call__(self, etag: Any | None = ..., data: Any | None = ..., include_weak: bool = ...): ...
def __bool__(self): ...
__nonzero__: Any
def __iter__(self): ...
@@ -380,7 +378,7 @@ class ETags(Container[str], Iterable[str]):
class IfRange:
etag: Any
date: Any
def __init__(self, etag: Optional[Any] = ..., date: Optional[Any] = ...): ...
def __init__(self, etag: Any | None = ..., date: Any | None = ...): ...
def to_header(self): ...
class Range:
@@ -394,12 +392,12 @@ class Range:
class ContentRange:
on_update: Any
units: Optional[str]
units: str | None
start: Any
stop: Any
length: Any
def __init__(self, units: Optional[str], start, stop, length: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def set(self, start, stop, length: Optional[Any] = ..., units: Optional[str] = ...): ...
def __init__(self, units: str | None, start, stop, length: Any | None = ..., on_update: Any | None = ...): ...
def set(self, start, stop, length: Any | None = ..., units: str | None = ...): ...
def unset(self) -> None: ...
def to_header(self): ...
def __nonzero__(self): ...
@@ -407,38 +405,36 @@ class ContentRange:
class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore
type: str
def __init__(self, auth_type: str, data: Optional[Mapping[str, Any]] = ...) -> None: ...
def __init__(self, auth_type: str, data: Mapping[str, Any] | None = ...) -> None: ...
@property
def username(self) -> Optional[str]: ...
def username(self) -> str | None: ...
@property
def password(self) -> Optional[str]: ...
def password(self) -> str | None: ...
@property
def realm(self) -> Optional[str]: ...
def realm(self) -> str | None: ...
@property
def nonce(self) -> Optional[str]: ...
def nonce(self) -> str | None: ...
@property
def uri(self) -> Optional[str]: ...
def uri(self) -> str | None: ...
@property
def nc(self) -> Optional[str]: ...
def nc(self) -> str | None: ...
@property
def cnonce(self) -> Optional[str]: ...
def cnonce(self) -> str | None: ...
@property
def response(self) -> Optional[str]: ...
def response(self) -> str | None: ...
@property
def opaque(self) -> Optional[str]: ...
def opaque(self) -> str | None: ...
@property
def qop(self) -> Optional[str]: ...
def qop(self) -> str | None: ...
class WWWAuthenticate(UpdateDictMixin, Dict[str, Any]):
on_update: Any
def __init__(self, auth_type: Optional[Any] = ..., values: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def __init__(self, auth_type: Any | None = ..., values: Any | None = ..., on_update: Any | None = ...): ...
def set_basic(self, realm: str = ...): ...
def set_digest(
self, realm, nonce, qop=..., opaque: Optional[Any] = ..., algorithm: Optional[Any] = ..., stale: bool = ...
): ...
def set_digest(self, realm, nonce, qop=..., opaque: Any | None = ..., algorithm: Any | None = ..., stale: bool = ...): ...
def to_header(self): ...
@staticmethod
def auth_property(name, doc: Optional[Any] = ...): ...
def auth_property(name, doc: Any | None = ...): ...
type: Any
realm: Any
domain: Any
@@ -449,28 +445,28 @@ class WWWAuthenticate(UpdateDictMixin, Dict[str, Any]):
stale: Any
class FileStorage(object):
name: Optional[Text]
name: Text | None
stream: IO[bytes]
filename: Optional[Text]
filename: Text | None
headers: Headers
def __init__(
self,
stream: Optional[IO[bytes]] = ...,
filename: Union[None, Text, bytes] = ...,
name: Optional[Text] = ...,
content_type: Optional[Text] = ...,
content_length: Optional[int] = ...,
headers: Optional[Headers] = ...,
stream: IO[bytes] | None = ...,
filename: None | Text | bytes = ...,
name: Text | None = ...,
content_type: Text | None = ...,
content_length: int | None = ...,
headers: Headers | None = ...,
): ...
@property
def content_type(self) -> Optional[Text]: ...
def content_type(self) -> Text | None: ...
@property
def content_length(self) -> int: ...
@property
def mimetype(self) -> str: ...
@property
def mimetype_params(self) -> Dict[str, str]: ...
def save(self, dst: Union[Text, SupportsWrite[bytes]], buffer_size: int = ...): ...
def save(self, dst: Text | SupportsWrite[bytes], buffer_size: int = ...): ...
def close(self) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response
@@ -32,9 +32,9 @@ class DebuggedApplication:
evalex: bool = ...,
request_key: str = ...,
console_path: str = ...,
console_init_func: Optional[Any] = ...,
console_init_func: Any | None = ...,
show_hidden_frames: bool = ...,
lodgeit_url: Optional[Any] = ...,
lodgeit_url: Any | None = ...,
pin_security: bool = ...,
pin_logging: bool = ...,
): ...
+3 -3
View File
@@ -1,5 +1,5 @@
import code
from typing import Any, Optional
from typing import Any
class HTMLStringO:
def __init__(self): ...
@@ -36,9 +36,9 @@ class _InteractiveConsole(code.InteractiveInterpreter):
def runsource(self, source): ...
def runcode(self, code): ...
def showtraceback(self): ...
def showsyntaxerror(self, filename: Optional[Any] = ...): ...
def showsyntaxerror(self, filename: Any | None = ...): ...
def write(self, data): ...
class Console:
def __init__(self, globals: Optional[Any] = ..., locals: Optional[Any] = ...): ...
def __init__(self, globals: Any | None = ..., locals: Any | None = ...): ...
def eval(self, code): ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
deque: Any
missing: Any
@@ -10,7 +10,7 @@ def debug_repr(obj): ...
def dump(obj=...): ...
class _Helper:
def __call__(self, topic: Optional[Any] = ...): ...
def __call__(self, topic: Any | None = ...): ...
helper: Any
@@ -30,4 +30,4 @@ class DebugReprGenerator:
def repr(self, obj): ...
def dump_object(self, obj): ...
def dump_locals(self, d): ...
def render_object_dump(self, items, title, repr: Optional[Any] = ...): ...
def render_object_dump(self, items, title, repr: Any | None = ...): ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
UTF8_COOKIE: Any
system_exceptions: Any
@@ -31,10 +31,10 @@ class Traceback:
def filter_hidden_frames(self): ...
def is_syntax_error(self): ...
def exception(self): ...
def log(self, logfile: Optional[Any] = ...): ...
def log(self, logfile: Any | None = ...): ...
def paste(self): ...
def render_summary(self, include_title: bool = ...): ...
def render_full(self, evalex: bool = ..., secret: Optional[Any] = ..., evalex_trusted: bool = ...): ...
def render_full(self, evalex: bool = ..., secret: Any | None = ..., evalex_trusted: bool = ...): ...
def generate_plaintext_traceback(self): ...
def plaintext(self): ...
id: Any
+22 -25
View File
@@ -1,6 +1,6 @@
import datetime
from _typeshed.wsgi import StartResponse, WSGIEnvironment
from typing import Any, Dict, Iterable, List, NoReturn, Optional, Protocol, Text, Tuple, Type, Union
from typing import Any, Dict, Iterable, List, NoReturn, Protocol, Text, Tuple, Type
from werkzeug.wrappers import Response
@@ -9,18 +9,18 @@ class _EnvironContainer(Protocol):
def environ(self) -> WSGIEnvironment: ...
class HTTPException(Exception):
code: Optional[int]
description: Optional[Text]
response: Optional[Response]
def __init__(self, description: Optional[Text] = ..., response: Optional[Response] = ...) -> None: ...
code: int | None
description: Text | None
response: Response | None
def __init__(self, description: Text | None = ..., response: Response | None = ...) -> None: ...
@classmethod
def wrap(cls, exception: Type[Exception], name: Optional[str] = ...) -> Any: ...
def wrap(cls, exception: Type[Exception], name: str | None = ...) -> Any: ...
@property
def name(self) -> str: ...
def get_description(self, environ: Optional[WSGIEnvironment] = ...) -> Text: ...
def get_body(self, environ: Optional[WSGIEnvironment] = ...) -> Text: ...
def get_headers(self, environ: Optional[WSGIEnvironment] = ...) -> List[Tuple[str, str]]: ...
def get_response(self, environ: Optional[Union[WSGIEnvironment, _EnvironContainer]] = ...) -> Response: ...
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_response(self, environ: WSGIEnvironment | _EnvironContainer | None = ...) -> Response: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
default_exceptions: Dict[int, Type[HTTPException]]
@@ -36,12 +36,12 @@ class BadHost(BadRequest): ...
class Unauthorized(HTTPException):
code: int
description: Text
www_authenticate: Optional[Iterable[object]]
www_authenticate: Iterable[object] | None
def __init__(
self,
description: Optional[Text] = ...,
response: Optional[Response] = ...,
www_authenticate: Union[None, Tuple[object, ...], List[object], object] = ...,
description: Text | None = ...,
response: Response | None = ...,
www_authenticate: None | Tuple[object, ...] | List[object] | object = ...,
) -> None: ...
class Forbidden(HTTPException):
@@ -56,7 +56,7 @@ class MethodNotAllowed(HTTPException):
code: int
description: Text
valid_methods: Any
def __init__(self, valid_methods: Optional[Any] = ..., description: Optional[Any] = ...): ...
def __init__(self, valid_methods: Any | None = ..., description: Any | None = ...): ...
class NotAcceptable(HTTPException):
code: int
@@ -99,7 +99,7 @@ class RequestedRangeNotSatisfiable(HTTPException):
description: Text
length: Any
units: str
def __init__(self, length: Optional[Any] = ..., units: str = ..., description: Optional[Any] = ...): ...
def __init__(self, length: Any | None = ..., units: str = ..., description: Any | None = ...): ...
class ExpectationFailed(HTTPException):
code: int
@@ -126,12 +126,9 @@ class PreconditionRequired(HTTPException):
description: Text
class _RetryAfter(HTTPException):
retry_after: Union[None, int, datetime.datetime]
retry_after: None | int | datetime.datetime
def __init__(
self,
description: Optional[Text] = ...,
response: Optional[Response] = ...,
retry_after: Union[None, int, datetime.datetime] = ...,
self, description: Text | None = ..., response: Response | None = ..., retry_after: None | int | datetime.datetime = ...
) -> None: ...
class TooManyRequests(_RetryAfter):
@@ -148,7 +145,7 @@ class UnavailableForLegalReasons(HTTPException):
class InternalServerError(HTTPException):
def __init__(
self, description: Optional[Text] = ..., response: Optional[Response] = ..., original_exception: Optional[Exception] = ...
self, description: Text | None = ..., response: Response | None = ..., original_exception: Exception | None = ...
) -> None: ...
code: int
description: Text
@@ -175,9 +172,9 @@ class HTTPVersionNotSupported(HTTPException):
class Aborter:
mapping: Any
def __init__(self, mapping: Optional[Any] = ..., extra: Optional[Any] = ...) -> None: ...
def __call__(self, code: Union[int, Response], *args: Any, **kwargs: Any) -> NoReturn: ...
def __init__(self, mapping: Any | None = ..., extra: Any | None = ...) -> None: ...
def __call__(self, code: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ...
def abort(status: Union[int, Response], *args: Any, **kwargs: Any) -> NoReturn: ...
def abort(status: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ...
class BadRequestKeyError(BadRequest, KeyError): ...
+23 -38
View File
@@ -1,20 +1,5 @@
from _typeshed.wsgi import WSGIEnvironment
from typing import (
IO,
Any,
Callable,
Dict,
Generator,
Iterable,
Mapping,
NoReturn,
Optional,
Protocol,
Text,
Tuple,
TypeVar,
Union,
)
from typing import IO, Any, Callable, Dict, Generator, Iterable, Mapping, NoReturn, Optional, Protocol, Text, Tuple, TypeVar
from .datastructures import Headers
@@ -25,20 +10,20 @@ _F = TypeVar("_F", bound=Callable[..., Any])
class _StreamFactory(Protocol):
def __call__(
self, total_content_length: Optional[int], filename: str, content_type: str, content_length: Optional[int] = ...
self, total_content_length: int | None, filename: str, content_type: str, content_length: int | None = ...
) -> IO[bytes]: ...
def default_stream_factory(
total_content_length: Optional[int], filename: str, content_type: str, content_length: Optional[int] = ...
total_content_length: int | None, filename: str, content_type: str, content_length: int | None = ...
) -> IO[bytes]: ...
def parse_form_data(
environ: WSGIEnvironment,
stream_factory: Optional[_StreamFactory] = ...,
stream_factory: _StreamFactory | None = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
max_content_length: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
max_form_memory_size: int | None = ...,
max_content_length: int | None = ...,
cls: Callable[[], _Dict] | None = ...,
silent: bool = ...,
) -> Tuple[IO[bytes], _Dict, _Dict]: ...
def exhaust_stream(f: _F) -> _F: ...
@@ -47,54 +32,54 @@ class FormDataParser(object):
stream_factory: _StreamFactory
charset: Text
errors: Text
max_form_memory_size: Optional[int]
max_content_length: Optional[int]
max_form_memory_size: int | None
max_content_length: int | None
cls: Callable[[], _Dict]
silent: bool
def __init__(
self,
stream_factory: Optional[_StreamFactory] = ...,
stream_factory: _StreamFactory | None = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
max_content_length: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
max_form_memory_size: int | None = ...,
max_content_length: int | None = ...,
cls: Callable[[], _Dict] | None = ...,
silent: bool = ...,
) -> None: ...
def get_parse_func(self, mimetype: str, options: Any) -> Optional[_ParseFunc]: ...
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(
self, stream: IO[bytes], mimetype: Text, content_length: Optional[int], options: Optional[Mapping[str, str]] = ...
self, stream: IO[bytes], mimetype: Text, content_length: int | None, options: Mapping[str, str] | None = ...
) -> Tuple[IO[bytes], _Dict, _Dict]: ...
parse_functions: Dict[Text, _ParseFunc]
def is_valid_multipart_boundary(boundary: str) -> bool: ...
def parse_multipart_headers(iterable: Iterable[Union[Text, bytes]]) -> Headers: ...
def parse_multipart_headers(iterable: Iterable[Text | bytes]) -> Headers: ...
class MultiPartParser(object):
charset: Text
errors: Text
max_form_memory_size: Optional[int]
max_form_memory_size: int | None
stream_factory: _StreamFactory
cls: Callable[[], _Dict]
buffer_size: int
def __init__(
self,
stream_factory: Optional[_StreamFactory] = ...,
stream_factory: _StreamFactory | None = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
max_form_memory_size: int | None = ...,
cls: Callable[[], _Dict] | None = ...,
buffer_size: int = ...,
) -> None: ...
def fail(self, message: Text) -> NoReturn: ...
def get_part_encoding(self, headers: Mapping[str, str]) -> Optional[str]: ...
def get_part_encoding(self, headers: Mapping[str, str]) -> str | None: ...
def get_part_charset(self, headers: Mapping[str, str]) -> Text: ...
def start_file_streaming(
self, filename: Union[Text, bytes], headers: Mapping[str, str], total_content_length: Optional[int]
self, filename: Text | bytes, headers: Mapping[str, str], total_content_length: int | None
) -> Tuple[Text, IO[bytes]]: ...
def in_memory_threshold_reached(self, bytes: Any) -> NoReturn: ...
def validate_boundary(self, boundary: Optional[str]) -> None: ...
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]: ...
+41 -58
View File
@@ -1,22 +1,7 @@
import sys
from _typeshed.wsgi import WSGIEnvironment
from datetime import datetime, timedelta
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
Optional,
SupportsInt,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing import Any, Callable, Dict, Iterable, List, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload
from .datastructures import (
Accept,
@@ -46,92 +31,90 @@ _U = TypeVar("_U")
HTTP_STATUS_CODES: Dict[int, str]
def wsgi_to_bytes(data: Union[bytes, Text]) -> bytes: ...
def wsgi_to_bytes(data: bytes | Text) -> bytes: ...
def bytes_to_wsgi(data: bytes) -> str: ...
def quote_header_value(value: Any, extra_chars: str = ..., allow_token: bool = ...) -> str: ...
def unquote_header_value(value: _Str, is_filename: bool = ...) -> _Str: ...
def dump_options_header(header: Optional[_Str], options: Mapping[_Str, Any]) -> _Str: ...
def dump_header(iterable: Union[Iterable[Any], Dict[_Str, Any]], allow_token: bool = ...) -> _Str: ...
def dump_options_header(header: _Str | None, options: Mapping[_Str, Any]) -> _Str: ...
def dump_header(iterable: Iterable[Any] | Dict[_Str, Any], allow_token: bool = ...) -> _Str: ...
def parse_list_header(value: _Str) -> List[_Str]: ...
@overload
def parse_dict_header(value: Union[bytes, Text]) -> Dict[Text, Optional[Text]]: ...
def parse_dict_header(value: bytes | Text) -> Dict[Text, Text | None]: ...
@overload
def parse_dict_header(value: Union[bytes, Text], cls: Type[_T]) -> _T: ...
def parse_dict_header(value: bytes | Text, cls: Type[_T]) -> _T: ...
@overload
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, Dict[str, Optional[str]]]: ...
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, Optional[_Str]]]: ...
def parse_options_header(value: _Str) -> Tuple[_Str, Dict[_Str, _Str | None]]: ...
# actually returns Tuple[_Str, Dict[_Str, Optional[_Str]], ...]
# actually returns Tuple[_Str, Dict[_Str, _Str | None], ...]
@overload
def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: ...
@overload
def parse_accept_header(value: Optional[Text]) -> Accept: ...
def parse_accept_header(value: Text | None) -> Accept: ...
@overload
def parse_accept_header(value: Optional[_Str], cls: Callable[[Optional[List[Tuple[str, float]]]], _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: Union[None, bytes, Text], on_update: Optional[Callable[[RequestCacheControl], Any]] = ...
value: None | bytes | Text, on_update: Callable[[RequestCacheControl], Any] | None = ...
) -> RequestCacheControl: ...
@overload
def parse_cache_control_header(
value: Union[None, bytes, Text], on_update: _T, cls: Callable[[Dict[Text, Optional[Text]], _T], _U]
value: None | bytes | Text, on_update: _T, cls: Callable[[Dict[Text, Text | None], _T], _U]
) -> _U: ...
@overload
def parse_cache_control_header(
value: Union[None, bytes, Text], *, cls: Callable[[Dict[Text, Optional[Text]], None], _U]
) -> _U: ...
def parse_set_header(value: Text, on_update: Optional[Callable[[HeaderSet], Any]] = ...) -> HeaderSet: ...
def parse_authorization_header(value: Union[None, bytes, Text]) -> Optional[Authorization]: ...
def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[Dict[Text, Text | None], None], _U]) -> _U: ...
def parse_set_header(value: Text, on_update: Callable[[HeaderSet], Any] | None = ...) -> HeaderSet: ...
def parse_authorization_header(value: None | bytes | Text) -> Authorization | None: ...
def parse_www_authenticate_header(
value: Union[None, bytes, Text], on_update: Optional[Callable[[WWWAuthenticate], Any]] = ...
value: None | bytes | Text, on_update: Callable[[WWWAuthenticate], Any] | None = ...
) -> WWWAuthenticate: ...
def parse_if_range_header(value: Optional[Text]) -> IfRange: ...
def parse_range_header(value: Optional[Text], make_inclusive: bool = ...) -> Optional[Range]: ...
def parse_if_range_header(value: Text | None) -> IfRange: ...
def parse_range_header(value: Text | None, make_inclusive: bool = ...) -> Range | None: ...
def parse_content_range_header(
value: Optional[Text], on_update: Optional[Callable[[ContentRange], Any]] = ...
) -> Optional[ContentRange]: ...
value: Text | None, on_update: Callable[[ContentRange], Any] | None = ...
) -> ContentRange | None: ...
def quote_etag(etag: _Str, weak: bool = ...) -> _Str: ...
def unquote_etag(etag: Optional[_Str]) -> Tuple[Optional[_Str], Optional[_Str]]: ...
def parse_etags(value: Optional[Text]) -> ETags: ...
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: Optional[str]) -> Optional[datetime]: ...
def cookie_date(expires: Union[None, float, datetime] = ...) -> str: ...
def http_date(timestamp: Union[None, float, datetime] = ...) -> str: ...
def parse_age(value: Optional[SupportsInt] = ...) -> Optional[timedelta]: ...
def dump_age(age: Union[None, timedelta, SupportsInt]) -> Optional[str]: ...
def parse_date(value: str | None) -> datetime | None: ...
def cookie_date(expires: None | float | datetime = ...) -> str: ...
def http_date(timestamp: None | float | datetime = ...) -> str: ...
def parse_age(value: SupportsInt | None = ...) -> timedelta | None: ...
def dump_age(age: None | timedelta | SupportsInt) -> str | None: ...
def is_resource_modified(
environ: WSGIEnvironment,
etag: Optional[Text] = ...,
data: Optional[_ETagData] = ...,
last_modified: Union[None, Text, datetime] = ...,
etag: Text | None = ...,
data: _ETagData | None = ...,
last_modified: None | Text | datetime = ...,
ignore_if_range: bool = ...,
) -> bool: ...
def remove_entity_headers(headers: Union[List[Tuple[Text, Text]], Headers], allowed: Iterable[Text] = ...) -> None: ...
def remove_hop_by_hop_headers(headers: Union[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
def parse_cookie(
header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ..., errors: Text = ...
header: None | WSGIEnvironment | Text | bytes, charset: Text = ..., errors: Text = ...
) -> TypeConversionDict[Any, Any]: ...
@overload
def parse_cookie(
header: Union[None, WSGIEnvironment, Text, bytes],
header: None | WSGIEnvironment | Text | bytes,
charset: Text = ...,
errors: Text = ...,
cls: Optional[Callable[[Iterable[Tuple[Text, Text]]], _T]] = ...,
cls: Callable[[Iterable[Tuple[Text, Text]]], _T] | None = ...,
) -> _T: ...
def dump_cookie(
key: _ToBytes,
value: _ToBytes = ...,
max_age: Union[None, float, timedelta] = ...,
expires: Union[None, Text, float, datetime] = ...,
path: Union[None, Tuple[Any, ...], str, bytes] = ...,
domain: Union[None, str, bytes] = ...,
max_age: None | float | timedelta = ...,
expires: None | Text | float | datetime = ...,
path: None | Tuple[Any, ...] | str | bytes = ...,
domain: None | str | bytes = ...,
secure: bool = ...,
httponly: bool = ...,
charset: Text = ...,
sync_expires: bool = ...,
) -> str: ...
def is_byte_range_valid(start: Optional[int], stop: Optional[int], length: Optional[int]) -> bool: ...
def is_byte_range_valid(start: int | None, stop: int | None, length: int | None) -> bool: ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
def release_local(local): ...
@@ -26,14 +26,14 @@ class LocalStack:
class LocalManager:
locals: Any
ident_func: Any
def __init__(self, locals: Optional[Any] = ..., ident_func: Optional[Any] = ...): ...
def __init__(self, locals: Any | None = ..., ident_func: Any | None = ...): ...
def get_ident(self): ...
def cleanup(self): ...
def make_middleware(self, app): ...
def middleware(self, func): ...
class LocalProxy:
def __init__(self, local, name: Optional[Any] = ...): ...
def __init__(self, local, name: Any | None = ...): ...
@property
def __dict__(self): ...
def __bool__(self): ...
@@ -1,8 +1,8 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Iterable, Mapping, Optional, Text
from typing import Iterable, Mapping, Text
class DispatcherMiddleware(object):
app: WSGIApplication
mounts: Mapping[Text, WSGIApplication]
def __init__(self, app: WSGIApplication, mounts: Optional[Mapping[Text, WSGIApplication]] = ...) -> None: ...
def __init__(self, app: WSGIApplication, mounts: Mapping[Text, WSGIApplication] | None = ...) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import SupportsWrite
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple
from typing import Any, Iterable, Iterator, List, Mapping, Protocol, Tuple
from ..datastructures import Headers
@@ -55,7 +55,7 @@ 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: Optional[Tuple[Any, ...]]
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: ...
@@ -1,5 +1,5 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
from typing import IO, Iterable, List, Text, Tuple
class ProfilerMiddleware(object):
def __init__(
@@ -7,8 +7,8 @@ class ProfilerMiddleware(object):
app: WSGIApplication,
stream: IO[str] = ...,
sort_by: Tuple[Text, Text] = ...,
restrictions: Iterable[Union[str, float]] = ...,
profile_dir: Optional[Text] = ...,
restrictions: Iterable[str | float] = ...,
profile_dir: Text | None = ...,
filename_format: Text = ...,
) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ...
@@ -1,5 +1,5 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Iterable, Optional
from typing import Iterable
class ProxyFix(object):
app: WSGIApplication
@@ -12,12 +12,12 @@ class ProxyFix(object):
def __init__(
self,
app: WSGIApplication,
num_proxies: Optional[int] = ...,
num_proxies: int | None = ...,
x_for: int = ...,
x_proto: int = ...,
x_host: int = ...,
x_port: int = ...,
x_prefix: int = ...,
) -> None: ...
def get_remote_addr(self, forwarded_for: Iterable[str]) -> Optional[str]: ...
def get_remote_addr(self, forwarded_for: Iterable[str]) -> str | None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -15,8 +15,8 @@ class SharedDataMiddleware(object):
def __init__(
self,
app: WSGIApplication,
exports: Union[Mapping[Text, _V], Iterable[Tuple[Text, _V]]],
disallow: Optional[Text] = ...,
exports: Mapping[Text, _V] | Iterable[Tuple[Text, _V]],
disallow: Text | None = ...,
cache: bool = ...,
cache_timeout: float = ...,
fallback_mimetype: Text = ...,
@@ -25,5 +25,5 @@ class SharedDataMiddleware(object):
def get_file_loader(self, filename: Text) -> _Loader: ...
def get_package_loader(self, package: Text, package_path: Text) -> _Loader: ...
def get_directory_loader(self, directory: Text) -> _Loader: ...
def generate_etag(self, mtime: datetime.datetime, file_size: int, real_filename: Union[Text, bytes]) -> str: ...
def generate_etag(self, mtime: datetime.datetime, file_size: int, real_filename: Text | bytes) -> str: ...
def __call__(self, environment: WSGIEnvironment, start_response: StartResponse) -> WSGIApplication: ...
+33 -44
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional, Text
from typing import Any, Text
from werkzeug.exceptions import HTTPException
@@ -23,11 +23,11 @@ class BuildError(RoutingException, LookupError):
endpoint: Any
values: Any
method: Any
adapter: Optional[MapAdapter]
def __init__(self, endpoint, values, method, adapter: Optional[MapAdapter] = ...) -> None: ...
adapter: MapAdapter | None
def __init__(self, endpoint, values, method, adapter: MapAdapter | None = ...) -> None: ...
@property
def suggested(self) -> Optional[Rule]: ...
def closest_rule(self, adapter: Optional[MapAdapter]) -> Optional[Rule]: ...
def suggested(self) -> Rule | None: ...
def closest_rule(self, adapter: MapAdapter | None) -> Rule | None: ...
class ValidationError(ValueError): ...
@@ -80,15 +80,15 @@ class Rule(RuleFactory):
def __init__(
self,
string,
defaults: Optional[Any] = ...,
subdomain: Optional[Any] = ...,
methods: Optional[Any] = ...,
defaults: Any | None = ...,
subdomain: Any | None = ...,
methods: Any | None = ...,
build_only: bool = ...,
endpoint: Optional[Any] = ...,
strict_slashes: Optional[Any] = ...,
redirect_to: Optional[Any] = ...,
endpoint: Any | None = ...,
strict_slashes: Any | None = ...,
redirect_to: Any | None = ...,
alias: bool = ...,
host: Optional[Any] = ...,
host: Any | None = ...,
): ...
def empty(self): ...
def get_empty_kwargs(self): ...
@@ -97,10 +97,10 @@ class Rule(RuleFactory):
def bind(self, map, rebind: bool = ...): ...
def get_converter(self, variable_name, converter_name, args, kwargs): ...
def compile(self): ...
def match(self, path, method: Optional[Any] = ...): ...
def match(self, path, method: Any | None = ...): ...
def build(self, values, append_unknown: bool = ...): ...
def provides_defaults_for(self, rule): ...
def suitable_for(self, values, method: Optional[Any] = ...): ...
def suitable_for(self, values, method: Any | None = ...): ...
def match_compare_key(self): ...
def build_compare_key(self): ...
def __eq__(self, other): ...
@@ -116,7 +116,7 @@ class BaseConverter:
class UnicodeConverter(BaseConverter):
regex: Any
def __init__(self, map, minlength: int = ..., maxlength: Optional[Any] = ..., length: Optional[Any] = ...): ...
def __init__(self, map, minlength: int = ..., maxlength: Any | None = ..., length: Any | None = ...): ...
class AnyConverter(BaseConverter):
regex: Any
@@ -131,7 +131,7 @@ class NumberConverter(BaseConverter):
fixed_digits: Any
min: Any
max: Any
def __init__(self, map, fixed_digits: int = ..., min: Optional[Any] = ..., max: Optional[Any] = ...): ...
def __init__(self, map, fixed_digits: int = ..., min: Any | None = ..., max: Any | None = ...): ...
def to_python(self, value): ...
def to_url(self, value) -> str: ...
@@ -142,7 +142,7 @@ class IntegerConverter(NumberConverter):
class FloatConverter(NumberConverter):
regex: Any
num_convert: Any
def __init__(self, map, min: Optional[Any] = ..., max: Optional[Any] = ...): ...
def __init__(self, map, min: Any | None = ..., max: Any | None = ...): ...
class UUIDConverter(BaseConverter):
regex: Any
@@ -164,31 +164,31 @@ class Map:
sort_key: Any
def __init__(
self,
rules: Optional[Any] = ...,
rules: Any | None = ...,
default_subdomain: str = ...,
charset: Text = ...,
strict_slashes: bool = ...,
redirect_defaults: bool = ...,
converters: Optional[Any] = ...,
converters: Any | None = ...,
sort_parameters: bool = ...,
sort_key: Optional[Any] = ...,
sort_key: Any | None = ...,
encoding_errors: Text = ...,
host_matching: bool = ...,
): ...
def is_endpoint_expecting(self, endpoint, *arguments): ...
def iter_rules(self, endpoint: Optional[Any] = ...): ...
def iter_rules(self, endpoint: Any | None = ...): ...
def add(self, rulefactory): ...
def bind(
self,
server_name,
script_name: Optional[Any] = ...,
subdomain: Optional[Any] = ...,
script_name: Any | None = ...,
subdomain: Any | None = ...,
url_scheme: str = ...,
default_method: str = ...,
path_info: Optional[Any] = ...,
query_args: Optional[Any] = ...,
path_info: Any | None = ...,
query_args: Any | None = ...,
): ...
def bind_to_environ(self, environ, server_name: Optional[Any] = ..., subdomain: Optional[Any] = ...): ...
def bind_to_environ(self, environ, server_name: Any | None = ..., subdomain: Any | None = ...): ...
def update(self): ...
class MapAdapter:
@@ -201,30 +201,19 @@ class MapAdapter:
default_method: Any
query_args: Any
def __init__(
self, map, server_name, script_name, subdomain, url_scheme, path_info, default_method, query_args: Optional[Any] = ...
): ...
def dispatch(
self, view_func, path_info: Optional[Any] = ..., method: Optional[Any] = ..., catch_http_exceptions: bool = ...
self, map, server_name, script_name, subdomain, url_scheme, path_info, default_method, query_args: Any | None = ...
): ...
def dispatch(self, view_func, path_info: Any | None = ..., method: Any | None = ..., catch_http_exceptions: bool = ...): ...
def match(
self,
path_info: Optional[Any] = ...,
method: Optional[Any] = ...,
return_rule: bool = ...,
query_args: Optional[Any] = ...,
self, path_info: Any | None = ..., method: Any | None = ..., return_rule: bool = ..., query_args: Any | None = ...
): ...
def test(self, path_info: Optional[Any] = ..., method: Optional[Any] = ...): ...
def allowed_methods(self, path_info: Optional[Any] = ...): ...
def test(self, path_info: Any | None = ..., method: Any | None = ...): ...
def allowed_methods(self, path_info: Any | None = ...): ...
def get_host(self, domain_part): ...
def get_default_redirect(self, rule, method, values, query_args): ...
def encode_query_args(self, query_args): ...
def make_redirect_url(self, path_info, query_args: Optional[Any] = ..., domain_part: Optional[Any] = ...): ...
def make_redirect_url(self, path_info, query_args: Any | None = ..., domain_part: Any | None = ...): ...
def make_alias_redirect_url(self, path, endpoint, values, method, query_args): ...
def build(
self,
endpoint,
values: Optional[Any] = ...,
method: Optional[Any] = ...,
force_external: bool = ...,
append_unknown: bool = ...,
self, endpoint, values: Any | None = ..., method: Any | None = ..., force_external: bool = ..., append_unknown: bool = ...
): ...
+6 -6
View File
@@ -1,14 +1,14 @@
from typing import Any, Optional
from typing import Any
argument_types: Any
converters: Any
def run(namespace: Optional[Any] = ..., action_prefix: str = ..., args: Optional[Any] = ...): ...
def run(namespace: Any | None = ..., action_prefix: str = ..., args: Any | None = ...): ...
def fail(message, code: int = ...): ...
def find_actions(namespace, action_prefix): ...
def print_usage(actions): ...
def analyse_action(func): ...
def make_shell(init_func: Optional[Any] = ..., banner: Optional[Any] = ..., use_ipython: bool = ...): ...
def make_shell(init_func: Any | None = ..., banner: Any | None = ..., use_ipython: bool = ...): ...
def make_runserver(
app_factory,
hostname: str = ...,
@@ -18,7 +18,7 @@ def make_runserver(
use_evalex: bool = ...,
threaded: bool = ...,
processes: int = ...,
static_files: Optional[Any] = ...,
extra_files: Optional[Any] = ...,
ssl_context: Optional[Any] = ...,
static_files: Any | None = ...,
extra_files: Any | None = ...,
ssl_context: Any | None = ...,
): ...
+3 -3
View File
@@ -1,10 +1,10 @@
from typing import Any, Optional
from typing import Any
SALT_CHARS: Any
DEFAULT_PBKDF2_ITERATIONS: Any
def pbkdf2_hex(data, salt, iterations=..., keylen: Optional[Any] = ..., hashfunc: Optional[Any] = ...): ...
def pbkdf2_bin(data, salt, iterations=..., keylen: Optional[Any] = ..., hashfunc: Optional[Any] = ...): ...
def pbkdf2_hex(data, salt, iterations=..., keylen: Any | None = ..., hashfunc: Any | None = ...): ...
def pbkdf2_bin(data, salt, iterations=..., keylen: Any | None = ..., hashfunc: Any | None = ...): ...
def safe_str_cmp(a, b): ...
def gen_salt(length): ...
def generate_password_hash(password, method: str = ..., salt_length: int = ...): ...
+24 -24
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Optional
from typing import Any
if sys.version_info >= (3, 0):
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -33,10 +33,10 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
def run_wsgi(self): ...
def handle(self): ...
def initiate_shutdown(self): ...
def connection_dropped(self, error, environ: Optional[Any] = ...): ...
def connection_dropped(self, error, environ: Any | None = ...): ...
raw_requestline: Any
def handle_one_request(self): ...
def send_response(self, code, message: Optional[Any] = ...): ...
def send_response(self, code, message: Any | None = ...): ...
def version_string(self): ...
def address_string(self): ...
def port_integer(self): ...
@@ -47,17 +47,17 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
BaseRequestHandler: Any
def generate_adhoc_ssl_pair(cn: Optional[Any] = ...): ...
def make_ssl_devcert(base_path, host: Optional[Any] = ..., cn: Optional[Any] = ...): ...
def generate_adhoc_ssl_pair(cn: Any | None = ...): ...
def make_ssl_devcert(base_path, host: Any | None = ..., cn: Any | None = ...): ...
def generate_adhoc_ssl_context(): ...
def load_ssl_context(cert_file, pkey_file: Optional[Any] = ..., protocol: Optional[Any] = ...): ...
def load_ssl_context(cert_file, pkey_file: Any | None = ..., protocol: Any | None = ...): ...
class _SSLContext:
def __init__(self, protocol): ...
def load_cert_chain(self, certfile, keyfile: Optional[Any] = ..., password: Optional[Any] = ...): ...
def load_cert_chain(self, certfile, keyfile: Any | None = ..., password: Any | None = ...): ...
def wrap_socket(self, sock, **kwargs): ...
def is_ssl_error(error: Optional[Any] = ...): ...
def is_ssl_error(error: Any | None = ...): ...
def select_ip_version(host, port): ...
class BaseWSGIServer(HTTPServer):
@@ -78,10 +78,10 @@ class BaseWSGIServer(HTTPServer):
host,
port,
app,
handler: Optional[Any] = ...,
handler: Any | None = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
ssl_context: Any | None = ...,
fd: Any | None = ...,
): ...
def log(self, type, message, *args): ...
def serve_forever(self): ...
@@ -101,22 +101,22 @@ class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer):
port,
app,
processes: int = ...,
handler: Optional[Any] = ...,
handler: Any | None = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
ssl_context: Any | None = ...,
fd: Any | None = ...,
): ...
def make_server(
host: Optional[Any] = ...,
port: Optional[Any] = ...,
app: Optional[Any] = ...,
host: Any | None = ...,
port: Any | None = ...,
app: Any | None = ...,
threaded: bool = ...,
processes: int = ...,
request_handler: Optional[Any] = ...,
request_handler: Any | None = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
ssl_context: Any | None = ...,
fd: Any | None = ...,
): ...
def is_running_from_reloader(): ...
def run_simple(
@@ -126,15 +126,15 @@ def run_simple(
use_reloader: bool = ...,
use_debugger: bool = ...,
use_evalex: bool = ...,
extra_files: Optional[Any] = ...,
extra_files: Any | None = ...,
reloader_interval: int = ...,
reloader_type: str = ...,
threaded: bool = ...,
processes: int = ...,
request_handler: Optional[Any] = ...,
static_files: Optional[Any] = ...,
request_handler: Any | None = ...,
static_files: Any | None = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
ssl_context: Any | None = ...,
): ...
def run_with_reloader(*args, **kwargs): ...
def main(): ...
+24 -30
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing import Any, Generic, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
if sys.version_info >= (3, 0):
@@ -10,17 +10,15 @@ else:
from cookielib import CookieJar
from urllib2 import Request as U2Request
def stream_encode_multipart(
values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., charset: Text = ...
): ...
def encode_multipart(values, boundary: Optional[Any] = ..., charset: Text = ...): ...
def File(fd, filename: Optional[Any] = ..., mimetype: Optional[Any] = ...): ...
def stream_encode_multipart(values, use_tempfile: int = ..., threshold=..., boundary: Any | None = ..., charset: Text = ...): ...
def encode_multipart(values, boundary: Any | None = ..., charset: Text = ...): ...
def File(fd, filename: Any | None = ..., mimetype: Any | None = ...): ...
class _TestCookieHeaders:
headers: Any
def __init__(self, headers): ...
def getheaders(self, name): ...
def get_all(self, name, default: Optional[Any] = ...): ...
def get_all(self, name, default: Any | None = ...): ...
class _TestCookieResponse:
headers: Any
@@ -55,20 +53,20 @@ class EnvironBuilder:
def __init__(
self,
path: str = ...,
base_url: Optional[Any] = ...,
query_string: Optional[Any] = ...,
base_url: Any | None = ...,
query_string: Any | None = ...,
method: str = ...,
input_stream: Optional[Any] = ...,
content_type: Optional[Any] = ...,
content_length: Optional[Any] = ...,
errors_stream: Optional[Any] = ...,
input_stream: Any | None = ...,
content_type: Any | None = ...,
content_length: Any | None = ...,
errors_stream: Any | None = ...,
multithread: bool = ...,
multiprocess: bool = ...,
run_once: bool = ...,
headers: Optional[Any] = ...,
data: Optional[Any] = ...,
environ_base: Optional[Any] = ...,
environ_overrides: Optional[Any] = ...,
headers: Any | None = ...,
data: Any | None = ...,
environ_base: Any | None = ...,
environ_overrides: Any | None = ...,
charset: Text = ...,
): ...
form: Any
@@ -80,40 +78,36 @@ class EnvironBuilder:
def __del__(self) -> None: ...
def close(self) -> None: ...
def get_environ(self) -> WSGIEnvironment: ...
def get_request(self, cls: Optional[Any] = ...): ...
def get_request(self, cls: Any | None = ...): ...
class ClientRedirectError(Exception): ...
# Response type for the client below.
# By default _R is Tuple[Iterable[Any], Union[Text, int], datastructures.Headers]
# By default _R is Tuple[Iterable[Any], Text | int, datastructures.Headers]
_R = TypeVar("_R")
class Client(Generic[_R]):
application: Any
response_wrapper: Optional[Type[_R]]
response_wrapper: Type[_R] | None
cookie_jar: Any
allow_subdomain_redirects: Any
def __init__(
self,
application,
response_wrapper: Optional[Type[_R]] = ...,
use_cookies: bool = ...,
allow_subdomain_redirects: bool = ...,
self, application, response_wrapper: Type[_R] | None = ..., use_cookies: bool = ..., allow_subdomain_redirects: bool = ...
): ...
def set_cookie(
self,
server_name,
key,
value: str = ...,
max_age: Optional[Any] = ...,
expires: Optional[Any] = ...,
max_age: Any | None = ...,
expires: Any | None = ...,
path: str = ...,
domain: Optional[Any] = ...,
secure: Optional[Any] = ...,
domain: Any | None = ...,
secure: Any | None = ...,
httponly: bool = ...,
charset: Text = ...,
): ...
def delete_cookie(self, server_name, key, path: str = ..., domain: Optional[Any] = ...): ...
def delete_cookie(self, server_name, key, path: str = ..., domain: Any | None = ...): ...
def run_wsgi_app(self, environ, buffered: bool = ...): ...
def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ...
@overload
+10 -10
View File
@@ -1,4 +1,4 @@
from typing import Any, NamedTuple, Optional, Text
from typing import Any, NamedTuple, Text
class _URLTuple(NamedTuple):
scheme: Any
@@ -31,7 +31,7 @@ class BaseURL(_URLTuple):
def decode_netloc(self): ...
def to_uri_tuple(self): ...
def to_iri_tuple(self): ...
def get_file_location(self, pathformat: Optional[Any] = ...): ...
def get_file_location(self, pathformat: Any | None = ...): ...
class URL(BaseURL):
def encode_netloc(self): ...
@@ -41,7 +41,7 @@ class BytesURL(BaseURL):
def encode_netloc(self): ...
def decode(self, charset: Text = ..., errors: Text = ...): ...
def url_parse(url, scheme: Optional[Any] = ..., allow_fragments: bool = ...): ...
def url_parse(url, scheme: Any | None = ..., allow_fragments: bool = ...): ...
def url_quote(string, charset: Text = ..., errors: Text = ..., safe: str = ..., unsafe: str = ...): ...
def url_quote_plus(string, charset: Text = ..., errors: Text = ..., safe: str = ...): ...
def url_unparse(components): ...
@@ -57,7 +57,7 @@ def url_decode(
include_empty: bool = ...,
errors: Text = ...,
separator: str = ...,
cls: Optional[Any] = ...,
cls: Any | None = ...,
): ...
def url_decode_stream(
stream,
@@ -66,20 +66,20 @@ def url_decode_stream(
include_empty: bool = ...,
errors: Text = ...,
separator: str = ...,
cls: Optional[Any] = ...,
limit: Optional[Any] = ...,
cls: Any | None = ...,
limit: Any | None = ...,
return_iterator: bool = ...,
): ...
def url_encode(
obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Optional[Any] = ..., separator: bytes = ...
obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Any | None = ..., separator: bytes = ...
): ...
def url_encode_stream(
obj,
stream: Optional[Any] = ...,
stream: Any | None = ...,
charset: Text = ...,
encode_keys: bool = ...,
sort: bool = ...,
key: Optional[Any] = ...,
key: Any | None = ...,
separator: bytes = ...,
): ...
def url_join(base, url, allow_fragments: bool = ...): ...
@@ -89,6 +89,6 @@ class Href:
charset: Text
sort: Any
key: Any
def __init__(self, base: str = ..., charset: Text = ..., sort: bool = ..., key: Optional[Any] = ...): ...
def __init__(self, base: str = ..., charset: Text = ..., sort: bool = ..., key: Any | None = ...): ...
def __getattr__(self, name): ...
def __call__(self, *path, **query): ...
+5 -5
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
class UserAgentParser:
platforms: Any
@@ -8,10 +8,10 @@ class UserAgentParser:
class UserAgent:
string: Any
platform: Optional[str]
browser: Optional[str]
version: Optional[str]
language: Optional[str]
platform: str | None
browser: str | None
version: str | None
language: str | None
def __init__(self, environ_or_string): ...
def to_header(self): ...
def __nonzero__(self): ...
+5 -5
View File
@@ -1,4 +1,4 @@
from typing import Any, Optional, Text, Type, TypeVar, overload
from typing import Any, Text, Type, TypeVar, overload
from werkzeug._internal import _DictAccessorProperty
from werkzeug.wrappers import Response
@@ -8,9 +8,9 @@ class cached_property(property):
__module__: Any
__doc__: Any
func: Any
def __init__(self, func, name: Optional[Any] = ..., doc: Optional[Any] = ...): ...
def __init__(self, func, name: Any | None = ..., doc: Any | None = ...): ...
def __set__(self, obj, value): ...
def __get__(self, obj, type: Optional[Any] = ...): ...
def __get__(self, obj, type: Any | None = ...): ...
class environ_property(_DictAccessorProperty):
read_only: Any
@@ -30,7 +30,7 @@ xhtml: Any
def get_content_type(mimetype, charset): ...
def format_string(string, context): ...
def secure_filename(filename: Text) -> Text: ...
def escape(s, quote: Optional[Any] = ...): ...
def escape(s, quote: Any | None = ...): ...
def unescape(s): ...
# 'redirect' returns a werkzeug Response, unless you give it
@@ -51,7 +51,7 @@ class ArgumentValidationError(ValueError):
missing: Any
extra: Any
extra_positional: Any
def __init__(self, missing: Optional[Any] = ..., extra: Optional[Any] = ..., extra_positional: Optional[Any] = ...): ...
def __init__(self, missing: Any | None = ..., extra: Any | None = ..., extra_positional: Any | None = ...): ...
class ImportStringError(ImportError):
import_name: Any
+42 -57
View File
@@ -1,21 +1,6 @@
from _typeshed.wsgi import InputStream, WSGIEnvironment
from datetime import datetime, timedelta
from typing import (
Any,
Callable,
Iterable,
Iterator,
Mapping,
MutableMapping,
Optional,
Sequence,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing import Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
from .datastructures import (
@@ -37,13 +22,13 @@ from .useragents import UserAgent
class BaseRequest:
charset: str
encoding_errors: str
max_content_length: Optional[int]
max_content_length: int | None
max_form_memory_size: int
parameter_storage_class: Type[Any]
list_storage_class: Type[Any]
dict_storage_class: Type[Any]
form_data_parser_class: Type[Any]
trusted_hosts: Optional[Sequence[Text]]
trusted_hosts: Sequence[Text] | None
disable_data_descriptor: Any
environ: WSGIEnvironment = ...
shallow: Any
@@ -110,7 +95,7 @@ _SelfT = TypeVar("_SelfT", bound=BaseResponse)
class BaseResponse:
charset: str
default_status: int
default_mimetype: Optional[str]
default_mimetype: str | None
implicit_sequence_conversion: bool
autocorrect_location_header: bool
automatically_set_content_length: bool
@@ -121,16 +106,16 @@ class BaseResponse:
response: Iterable[bytes]
def __init__(
self,
response: Optional[Union[str, bytes, bytearray, Iterable[str], Iterable[bytes]]] = ...,
status: Optional[Union[Text, int]] = ...,
headers: Optional[Union[Headers, Mapping[Text, Text], Sequence[Tuple[Text, Text]]]] = ...,
mimetype: Optional[Text] = ...,
content_type: Optional[Text] = ...,
response: str | bytes | bytearray | Iterable[str] | Iterable[bytes] | None = ...,
status: Text | int | None = ...,
headers: Headers | Mapping[Text, Text] | Sequence[Tuple[Text, Text]] | None = ...,
mimetype: Text | None = ...,
content_type: Text | None = ...,
direct_passthrough: bool = ...,
) -> None: ...
def call_on_close(self, func: _OnCloseT) -> _OnCloseT: ...
@classmethod
def force_type(cls: Type[_SelfT], response: object, environ: Optional[WSGIEnvironment] = ...) -> _SelfT: ...
def force_type(cls: Type[_SelfT], response: object, environ: WSGIEnvironment | None = ...) -> _SelfT: ...
@classmethod
def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ...
@overload
@@ -139,24 +124,24 @@ class BaseResponse:
def get_data(self, as_text: Literal[True]) -> Text: ...
@overload
def get_data(self, as_text: bool) -> Any: ...
def set_data(self, value: Union[bytes, Text]) -> None: ...
def set_data(self, value: bytes | Text) -> None: ...
data: Any
def calculate_content_length(self) -> Optional[int]: ...
def calculate_content_length(self) -> int | None: ...
def make_sequence(self) -> None: ...
def iter_encoded(self) -> Iterator[bytes]: ...
def set_cookie(
self,
key: str,
value: Union[str, bytes] = ...,
max_age: Union[float, timedelta, None] = ...,
expires: Optional[Union[int, datetime]] = ...,
value: str | bytes = ...,
max_age: float | timedelta | None = ...,
expires: int | datetime | None = ...,
path: str = ...,
domain: Optional[str] = ...,
domain: str | None = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: Optional[str] = ...,
samesite: str | None = ...,
) -> None: ...
def delete_cookie(self, key, path: str = ..., domain: Optional[Any] = ...): ...
def delete_cookie(self, key, path: str = ..., domain: Any | None = ...): ...
@property
def is_streamed(self) -> bool: ...
@property
@@ -204,7 +189,7 @@ class UserAgentMixin:
class AuthorizationMixin:
@property
def authorization(self) -> Optional[Authorization]: ...
def authorization(self) -> Authorization | None: ...
class StreamOnlyMixin:
disable_data_descriptor: Any
@@ -214,7 +199,7 @@ class ETagResponseMixin:
@property
def cache_control(self): ...
status_code: Any
def make_conditional(self, request_or_environ, accept_ranges: bool = ..., complete_length: Optional[Any] = ...): ...
def make_conditional(self, request_or_environ, accept_ranges: bool = ..., complete_length: Any | None = ...): ...
def add_etag(self, overwrite: bool = ..., weak: bool = ...): ...
def set_etag(self, etag, weak: bool = ...): ...
def get_etag(self): ...
@@ -241,19 +226,19 @@ class ResponseStreamMixin:
class CommonRequestDescriptorsMixin:
@property
def content_type(self) -> Optional[str]: ...
def content_type(self) -> str | None: ...
@property
def content_length(self) -> Optional[int]: ...
def content_length(self) -> int | None: ...
@property
def content_encoding(self) -> Optional[str]: ...
def content_encoding(self) -> str | None: ...
@property
def content_md5(self) -> Optional[str]: ...
def content_md5(self) -> str | None: ...
@property
def referrer(self) -> Optional[str]: ...
def referrer(self) -> str | None: ...
@property
def date(self) -> Optional[datetime]: ...
def date(self) -> datetime | None: ...
@property
def max_forwards(self) -> Optional[int]: ...
def max_forwards(self) -> int | None: ...
@property
def mimetype(self) -> str: ...
@property
@@ -262,23 +247,23 @@ class CommonRequestDescriptorsMixin:
def pragma(self) -> HeaderSet: ...
class CommonResponseDescriptorsMixin:
mimetype: Optional[str] = ...
mimetype: str | None = ...
@property
def mimetype_params(self) -> MutableMapping[str, str]: ...
location: Optional[str] = ...
age: Any = ... # get: Optional[datetime.timedelta]
content_type: Optional[str] = ...
content_length: Optional[int] = ...
content_location: Optional[str] = ...
content_encoding: Optional[str] = ...
content_md5: Optional[str] = ...
date: Any = ... # get: Optional[datetime.datetime]
expires: Any = ... # get: Optional[datetime.datetime]
last_modified: Any = ... # get: Optional[datetime.datetime]
retry_after: Any = ... # get: Optional[datetime.datetime]
vary: Optional[str] = ...
content_language: Optional[str] = ...
allow: Optional[str] = ...
location: str | None = ...
age: Any = ... # get: datetime.timedelta | None
content_type: str | None = ...
content_length: int | None = ...
content_location: str | None = ...
content_encoding: str | None = ...
content_md5: str | None = ...
date: Any = ... # get: datetime.datetime | None
expires: Any = ... # get: datetime.datetime | None
last_modified: Any = ... # get: datetime.datetime | None
retry_after: Any = ... # get: datetime.datetime | None
vary: str | None = ...
content_language: str | None = ...
allow: str | None = ...
class WWWAuthenticateMixin:
@property
+12 -12
View File
@@ -1,6 +1,6 @@
from _typeshed import SupportsRead
from _typeshed.wsgi import InputStream, WSGIEnvironment
from typing import Any, Iterable, Optional, Text
from typing import Any, Iterable, Text
from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware
from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware
@@ -8,11 +8,11 @@ from .middleware.shared_data import SharedDataMiddleware as SharedDataMiddleware
def responder(f): ...
def get_current_url(
environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., trusted_hosts: Optional[Any] = ...
environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., trusted_hosts: Any | None = ...
): ...
def host_is_trusted(hostname, trusted_list): ...
def get_host(environ, trusted_hosts: Optional[Any] = ...): ...
def get_content_length(environ: WSGIEnvironment) -> Optional[int]: ...
def get_host(environ, trusted_hosts: Any | None = ...): ...
def get_content_length(environ: WSGIEnvironment) -> int | None: ...
def get_input_stream(environ: WSGIEnvironment, safe_fallback: bool = ...) -> InputStream: ...
def get_query_string(environ): ...
def get_path_info(environ, charset: Text = ..., errors: Text = ...): ...
@@ -24,7 +24,7 @@ def extract_path_info(
): ...
class ClosingIterator:
def __init__(self, iterable, callbacks: Optional[Any] = ...): ...
def __init__(self, iterable, callbacks: Any | None = ...): ...
def __iter__(self): ...
def __next__(self): ...
def close(self): ...
@@ -38,7 +38,7 @@ class FileWrapper:
def close(self) -> None: ...
def seekable(self) -> bool: ...
def seek(self, offset: int, whence: int = ...) -> None: ...
def tell(self) -> Optional[int]: ...
def tell(self) -> int | None: ...
def __iter__(self) -> FileWrapper: ...
def __next__(self) -> bytes: ...
@@ -50,13 +50,13 @@ class _RangeWrapper:
read_length: Any
seekable: Any
end_reached: Any
def __init__(self, iterable, start_byte: int = ..., byte_range: Optional[Any] = ...): ...
def __init__(self, iterable, start_byte: int = ..., byte_range: Any | None = ...): ...
def __iter__(self): ...
def __next__(self): ...
def close(self): ...
def make_line_iter(stream, limit: Optional[Any] = ..., buffer_size=..., cap_at_buffer: bool = ...): ...
def make_chunk_iter(stream, separator, limit: Optional[Any] = ..., buffer_size=..., cap_at_buffer: bool = ...): ...
def make_line_iter(stream, limit: Any | None = ..., buffer_size=..., cap_at_buffer: bool = ...): ...
def make_chunk_iter(stream, separator, limit: Any | None = ..., buffer_size=..., cap_at_buffer: bool = ...): ...
class LimitedStream:
limit: Any
@@ -67,8 +67,8 @@ class LimitedStream:
def on_exhausted(self): ...
def on_disconnect(self): ...
def exhaust(self, chunk_size=...): ...
def read(self, size: Optional[Any] = ...): ...
def readline(self, size: Optional[Any] = ...): ...
def readlines(self, size: Optional[Any] = ...): ...
def read(self, size: Any | None = ...): ...
def readline(self, size: Any | None = ...): ...
def readlines(self, size: Any | None = ...): ...
def tell(self): ...
def __next__(self): ...