Re-organize directory structure (#4971)

See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
Ivan Levkivskyi
2021-01-27 12:00:39 +00:00
committed by GitHub
parent 869238e587
commit 16ae4c6120
1399 changed files with 601 additions and 97 deletions
+151
View File
@@ -0,0 +1,151 @@
from types import ModuleType
from typing import Any
from werkzeug import (
_internal,
datastructures,
debug,
exceptions,
formparser,
http,
local,
security,
serving,
test,
testapp,
urls,
useragents,
utils,
wrappers,
wsgi,
)
class module(ModuleType):
def __getattr__(self, name): ...
def __dir__(self): ...
__version__: Any
run_simple = serving.run_simple
test_app = testapp.test_app
UserAgent = useragents.UserAgent
_easteregg = _internal._easteregg
DebuggedApplication = debug.DebuggedApplication
MultiDict = datastructures.MultiDict
CombinedMultiDict = datastructures.CombinedMultiDict
Headers = datastructures.Headers
EnvironHeaders = datastructures.EnvironHeaders
ImmutableList = datastructures.ImmutableList
ImmutableDict = datastructures.ImmutableDict
ImmutableMultiDict = datastructures.ImmutableMultiDict
TypeConversionDict = datastructures.TypeConversionDict
ImmutableTypeConversionDict = datastructures.ImmutableTypeConversionDict
Accept = datastructures.Accept
MIMEAccept = datastructures.MIMEAccept
CharsetAccept = datastructures.CharsetAccept
LanguageAccept = datastructures.LanguageAccept
RequestCacheControl = datastructures.RequestCacheControl
ResponseCacheControl = datastructures.ResponseCacheControl
ETags = datastructures.ETags
HeaderSet = datastructures.HeaderSet
WWWAuthenticate = datastructures.WWWAuthenticate
Authorization = datastructures.Authorization
FileMultiDict = datastructures.FileMultiDict
CallbackDict = datastructures.CallbackDict
FileStorage = datastructures.FileStorage
OrderedMultiDict = datastructures.OrderedMultiDict
ImmutableOrderedMultiDict = datastructures.ImmutableOrderedMultiDict
escape = utils.escape
environ_property = utils.environ_property
append_slash_redirect = utils.append_slash_redirect
redirect = utils.redirect
cached_property = utils.cached_property
import_string = utils.import_string
dump_cookie = http.dump_cookie
parse_cookie = http.parse_cookie
unescape = utils.unescape
format_string = utils.format_string
find_modules = utils.find_modules
header_property = utils.header_property
html = utils.html
xhtml = utils.xhtml
HTMLBuilder = utils.HTMLBuilder
validate_arguments = utils.validate_arguments
ArgumentValidationError = utils.ArgumentValidationError
bind_arguments = utils.bind_arguments
secure_filename = utils.secure_filename
BaseResponse = wrappers.BaseResponse
BaseRequest = wrappers.BaseRequest
Request = wrappers.Request
Response = wrappers.Response
AcceptMixin = wrappers.AcceptMixin
ETagRequestMixin = wrappers.ETagRequestMixin
ETagResponseMixin = wrappers.ETagResponseMixin
ResponseStreamMixin = wrappers.ResponseStreamMixin
CommonResponseDescriptorsMixin = wrappers.CommonResponseDescriptorsMixin
UserAgentMixin = wrappers.UserAgentMixin
AuthorizationMixin = wrappers.AuthorizationMixin
WWWAuthenticateMixin = wrappers.WWWAuthenticateMixin
CommonRequestDescriptorsMixin = wrappers.CommonRequestDescriptorsMixin
Local = local.Local
LocalManager = local.LocalManager
LocalProxy = local.LocalProxy
LocalStack = local.LocalStack
release_local = local.release_local
generate_password_hash = security.generate_password_hash
check_password_hash = security.check_password_hash
Client = test.Client
EnvironBuilder = test.EnvironBuilder
create_environ = test.create_environ
run_wsgi_app = test.run_wsgi_app
get_current_url = wsgi.get_current_url
get_host = wsgi.get_host
pop_path_info = wsgi.pop_path_info
peek_path_info = wsgi.peek_path_info
SharedDataMiddleware = wsgi.SharedDataMiddleware
DispatcherMiddleware = wsgi.DispatcherMiddleware
ClosingIterator = wsgi.ClosingIterator
FileWrapper = wsgi.FileWrapper
make_line_iter = wsgi.make_line_iter
LimitedStream = wsgi.LimitedStream
responder = wsgi.responder
wrap_file = wsgi.wrap_file
extract_path_info = wsgi.extract_path_info
parse_etags = http.parse_etags
parse_date = http.parse_date
http_date = http.http_date
cookie_date = http.cookie_date
parse_cache_control_header = http.parse_cache_control_header
is_resource_modified = http.is_resource_modified
parse_accept_header = http.parse_accept_header
parse_set_header = http.parse_set_header
quote_etag = http.quote_etag
unquote_etag = http.unquote_etag
generate_etag = http.generate_etag
dump_header = http.dump_header
parse_list_header = http.parse_list_header
parse_dict_header = http.parse_dict_header
parse_authorization_header = http.parse_authorization_header
parse_www_authenticate_header = http.parse_www_authenticate_header
remove_entity_headers = http.remove_entity_headers
is_entity_header = http.is_entity_header
remove_hop_by_hop_headers = http.remove_hop_by_hop_headers
parse_options_header = http.parse_options_header
dump_options_header = http.dump_options_header
is_hop_by_hop_header = http.is_hop_by_hop_header
unquote_header_value = http.unquote_header_value
quote_header_value = http.quote_header_value
HTTP_STATUS_CODES = http.HTTP_STATUS_CODES
url_decode = urls.url_decode
url_encode = urls.url_encode
url_quote = urls.url_quote
url_quote_plus = urls.url_quote_plus
url_unquote = urls.url_unquote
url_unquote_plus = urls.url_unquote_plus
url_fix = urls.url_fix
Href = urls.Href
iri_to_uri = urls.iri_to_uri
uri_to_iri = urls.uri_to_iri
parse_form_data = formparser.parse_form_data
abort = exceptions.Aborter
Aborter = exceptions.Aborter
+53
View File
@@ -0,0 +1,53 @@
import sys
from typing import Any, Optional, Text
if sys.version_info >= (3,):
from io import BytesIO as BytesIO, StringIO as StringIO
NativeStringIO = StringIO
else:
import cStringIO
from StringIO import StringIO as StringIO
BytesIO = cStringIO.StringIO
NativeStringIO = BytesIO
PY2: Any
WIN: Any
unichr: Any
text_type: Any
string_types: Any
integer_types: Any
iterkeys: Any
itervalues: Any
iteritems: Any
iterlists: Any
iterlistvalues: Any
int_to_byte: Any
iter_bytes: Any
def fix_tuple_repr(obj): ...
def implements_iterator(cls): ...
def implements_to_string(cls): ...
def native_string_result(func): ...
def implements_bool(cls): ...
range_type: Any
def make_literal_wrapper(reference): ...
def normalize_string_tuple(tup): ...
def try_coerce_native(s): ...
wsgi_get_bytes: Any
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] = ...): ...
imap: Any
izip: Any
ifilter: Any
def to_unicode(x, charset: Text = ..., errors: Text = ..., allow_none_charset: bool = ...): ...
+26
View File
@@ -0,0 +1,26 @@
from typing import Any, Optional
class _Missing:
def __reduce__(self): ...
class _DictAccessorProperty:
read_only: Any
name: Any
default: Any
load_func: Any
dump_func: Any
__doc__: Any
def __init__(
self,
name,
default: Optional[Any] = ...,
load_func: Optional[Any] = ...,
dump_func: Optional[Any] = ...,
read_only: Optional[Any] = ...,
doc: Optional[Any] = ...,
): ...
def __get__(self, obj, type: Optional[Any] = ...): ...
def __set__(self, obj, value): ...
def __delete__(self, obj): ...
def _easteregg(app: Optional[Any] = ...): ...
+29
View File
@@ -0,0 +1,29 @@
from typing import Any, Optional
class ReloaderLoop:
name: Any
extra_files: Any
interval: float
def __init__(self, extra_files: Optional[Any] = ..., interval: float = ...): ...
def run(self): ...
def restart_with_reloader(self): ...
def trigger_reload(self, filename): ...
def log_reload(self, filename): ...
class StatReloaderLoop(ReloaderLoop):
name: Any
def run(self): ...
class WatchdogReloaderLoop(ReloaderLoop):
observable_paths: Any
name: Any
observer_class: Any
event_handler: Any
should_reload: Any
def __init__(self, *args, **kwargs): ...
def trigger_reload(self, filename): ...
def run(self): ...
reloader_loops: Any
def run_with_reloader(main_func, extra_files: Optional[Any] = ..., interval: float = ..., reloader_type: str = ...): ...
+50
View File
@@ -0,0 +1,50 @@
from typing import Any, Optional
XHTML_NAMESPACE: Any
def format_iso8601(obj): ...
class AtomFeed:
default_generator: Any
title: Any
title_type: Any
url: Any
feed_url: Any
id: Any
updated: Any
author: Any
icon: Any
logo: Any
rights: Any
rights_type: Any
subtitle: Any
subtitle_type: Any
generator: Any
links: Any
entries: Any
def __init__(self, title: Optional[Any] = ..., entries: Optional[Any] = ..., **kwargs): ...
def add(self, *args, **kwargs): ...
def generate(self): ...
def to_string(self): ...
def get_response(self): ...
def __call__(self, environ, start_response): ...
class FeedEntry:
title: Any
title_type: Any
content: Any
content_type: Any
url: Any
id: Any
updated: Any
summary: Any
summary_type: Any
author: Any
published: Any
rights: Any
links: Any
categories: Any
xml_base: Any
def __init__(self, title: Optional[Any] = ..., content: Optional[Any] = ..., feed_url: Optional[Any] = ..., **kwargs): ...
def generate(self): ...
def to_string(self): ...
+92
View File
@@ -0,0 +1,92 @@
from typing import Any, Optional
class BaseCache:
default_timeout: float
def __init__(self, default_timeout: float = ...): ...
def get(self, key): ...
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 delete_many(self, *keys): ...
def has(self, key): ...
def clear(self): ...
def inc(self, key, delta=...): ...
def dec(self, key, delta=...): ...
class NullCache(BaseCache): ...
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 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 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 get_many(self, *keys): ...
def set_many(self, mapping, timeout: Optional[float] = ...): ...
def delete(self, key): ...
def delete_many(self, *keys): ...
def has(self, key): ...
def clear(self): ...
def inc(self, key, delta=...): ...
def dec(self, key, delta=...): ...
def import_preferred_memcache_lib(self, servers): ...
GAEMemcachedCache: Any
class RedisCache(BaseCache):
key_prefix: Any
def __init__(
self,
host: str = ...,
port: int = ...,
password: Optional[Any] = ...,
db: int = ...,
default_timeout: float = ...,
key_prefix: Optional[Any] = ...,
**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 delete(self, key): ...
def delete_many(self, *keys): ...
def has(self, key): ...
def clear(self): ...
def inc(self, key, delta=...): ...
def dec(self, key, delta=...): ...
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 delete(self, key): ...
def has(self, key): ...
class UWSGICache(BaseCache):
cache: Any
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 clear(self): ...
def has(self, key): ...
@@ -0,0 +1,35 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, List, Mapping, Optional, Set, Text
from ..middleware.proxy_fix import ProxyFix as ProxyFix
class CGIRootFix(object):
app: WSGIApplication
app_root: Text
def __init__(self, app: WSGIApplication, app_root: Text = ...) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
class LighttpdCGIRootFix(CGIRootFix): ...
class PathInfoFromRequestUriFix(object):
app: WSGIApplication
def __init__(self, app: WSGIApplication) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
class HeaderRewriterFix(object):
app: WSGIApplication
remove_headers: Set[Text]
add_headers: List[Text]
def __init__(
self, app: WSGIApplication, remove_headers: Optional[Iterable[Text]] = ..., add_headers: Optional[Iterable[Text]] = ...
) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
class InternetExplorerFix(object):
app: WSGIApplication
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 run_fixed(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -0,0 +1,39 @@
from typing import Any, Optional, Text, Union
greenlet: Any
class IterIO:
def __new__(cls, obj, sentinel: Union[Text, bytes] = ...): ...
def __iter__(self): ...
def tell(self): ...
def isatty(self): ...
def seek(self, pos, mode: int = ...): ...
def truncate(self, size: Optional[Any] = ...): ...
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 flush(self): ...
def __next__(self): ...
class IterI(IterIO):
sentinel: Any
def __new__(cls, func, sentinel: Union[Text, bytes] = ...): ...
closed: Any
def close(self): ...
def write(self, s): ...
def writelines(self, list): ...
def flush(self): ...
class IterO(IterIO):
sentinel: Any
closed: Any
pos: Any
def __new__(cls, gen, sentinel: Union[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 readlines(self, sizehint: int = ...): ...
@@ -0,0 +1,10 @@
from typing import Any
def dumps(*args): ...
def render_template(name_parts, rules, converters): ...
def generate_map(map, name: str = ...): ...
def generate_adapter(adapter, name: str = ..., map_name: str = ...): ...
def js_to_url_function(converter): ...
def NumberConverter_js_to_url(conv): ...
js_to_url_functions: Any
@@ -0,0 +1,7 @@
from typing import Any
class StreamLimitMiddleware:
app: Any
maximum_size: Any
def __init__(self, app, maximum_size=...): ...
def __call__(self, environ, start_response): ...
+1
View File
@@ -0,0 +1 @@
from ..middleware.lint import *
@@ -0,0 +1,9 @@
from _typeshed import SupportsWrite
from typing import AnyStr, Generic, Tuple
from ..middleware.profiler import *
class MergeStream(Generic[AnyStr]):
streams: Tuple[SupportsWrite[AnyStr], ...]
def __init__(self, *streams: SupportsWrite[AnyStr]) -> None: ...
def write(self, data: AnyStr) -> None: ...
@@ -0,0 +1,39 @@
from hashlib import sha1 as _default_hash
from hmac import new as hmac
from typing import Any, Optional
from werkzeug.contrib.sessions import ModificationTrackingDict
class UnquoteError(Exception): ...
class SecureCookie(ModificationTrackingDict[Any, Any]):
hash_method: Any
serialization_method: Any
quote_base64: Any
secret_key: Any
new: Any
def __init__(self, data: Optional[Any] = ..., secret_key: Optional[Any] = ..., new: bool = ...): ...
@property
def should_save(self): ...
@classmethod
def quote(cls, value): ...
@classmethod
def unquote(cls, value): ...
def serialize(self, expires: Optional[Any] = ...): ...
@classmethod
def unserialize(cls, string, secret_key): ...
@classmethod
def load_cookie(cls, request, key: str = ..., secret_key: Optional[Any] = ...): ...
def save_cookie(
self,
response,
key: str = ...,
expires: Optional[Any] = ...,
session_expires: Optional[Any] = ...,
max_age: Optional[Any] = ...,
path: str = ...,
domain: Optional[Any] = ...,
secure: Optional[Any] = ...,
httponly: bool = ...,
force: bool = ...,
): ...
@@ -0,0 +1,77 @@
from typing import Any, Optional, Text, TypeVar
from werkzeug.datastructures import CallbackDict
_K = TypeVar("_K")
_V = TypeVar("_V")
def generate_key(salt: Optional[Any] = ...): ...
class ModificationTrackingDict(CallbackDict[_K, _V]):
modified: Any
def __init__(self, *args, **kwargs): ...
def copy(self): ...
def __copy__(self): ...
class Session(ModificationTrackingDict[_K, _V]):
sid: Any
new: Any
def __init__(self, data, sid, new: bool = ...): ...
@property
def should_save(self): ...
class SessionStore:
session_class: Any
def __init__(self, session_class: Optional[Any] = ...): ...
def is_valid_key(self, key): ...
def generate_key(self, salt: Optional[Any] = ...): ...
def new(self): ...
def save(self, session): ...
def save_if_modified(self, session): ...
def delete(self, session): ...
def get(self, sid): ...
class FilesystemSessionStore(SessionStore):
path: Any
filename_template: str
renew_missing: Any
mode: Any
def __init__(
self,
path: Optional[Any] = ...,
filename_template: Text = ...,
session_class: Optional[Any] = ...,
renew_missing: bool = ...,
mode: int = ...,
): ...
def get_session_filename(self, sid): ...
def save(self, session): ...
def delete(self, session): ...
def get(self, sid): ...
def list(self): ...
class SessionMiddleware:
app: Any
store: Any
cookie_name: Any
cookie_age: Any
cookie_expires: Any
cookie_path: Any
cookie_domain: Any
cookie_secure: Any
cookie_httponly: Any
environ_key: Any
def __init__(
self,
app,
store,
cookie_name: str = ...,
cookie_age: Optional[Any] = ...,
cookie_expires: Optional[Any] = ...,
cookie_path: str = ...,
cookie_domain: Optional[Any] = ...,
cookie_secure: Optional[Any] = ...,
cookie_httponly: bool = ...,
environ_key: str = ...,
): ...
def __call__(self, environ, start_response): ...
@@ -0,0 +1,8 @@
from werkzeug.wrappers import Response
class ContentAccessors:
def xml(self): ...
def lxml(self): ...
def json(self): ...
class TestResponse(Response, ContentAccessors): ...
@@ -0,0 +1,27 @@
from typing import Any
def is_known_charset(charset): ...
class JSONRequestMixin:
def json(self): ...
class ProtobufRequestMixin:
protobuf_check_initialization: Any
def parse_protobuf(self, proto_type): ...
class RoutingArgsRequestMixin:
routing_args: Any
routing_vars: Any
class ReverseSlashBehaviorRequestMixin:
def path(self): ...
def script_root(self): ...
class DynamicCharsetRequestMixin:
default_charset: Any
def unknown_charset(self, charset): ...
def charset(self): ...
class DynamicCharsetResponseMixin:
default_charset: Any
charset: Any
+464
View File
@@ -0,0 +1,464 @@
import sys
from _typeshed import SupportsWrite
from typing import (
IO,
Any,
Callable,
Container,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
MutableSet,
NoReturn,
Optional,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
if sys.version_info >= (3, 8):
from typing import SupportsIndex
else:
from typing_extensions import SupportsIndex
_K = TypeVar("_K")
_V = TypeVar("_V")
_R = TypeVar("_R")
_D = TypeVar("_D")
def is_immutable(self) -> NoReturn: ...
def iter_multi_items(mapping): ...
def native_itermethods(names): ...
class ImmutableListMixin(Generic[_V]):
def __hash__(self) -> int: ...
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[_V], List[_V]): ... # type: ignore
class ImmutableDictMixin(object):
@classmethod
def fromkeys(cls, *args, **kwargs): ...
def __reduce_ex__(self, protocol): ...
def __hash__(self) -> int: ...
def setdefault(self, key, default: Optional[Any] = ...): ...
def update(self, *args, **kwargs): ...
def pop(self, key, default: Optional[Any] = ...): ...
def popitem(self): ...
def __setitem__(self, key, value): ...
def __delitem__(self, key): ...
def clear(self): ...
class ImmutableMultiDictMixin(ImmutableDictMixin):
def __reduce_ex__(self, protocol): ...
def add(self, key, value): ...
def popitemlist(self): ...
def poplist(self, key): ...
def setlist(self, key, new_list): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
class UpdateDictMixin(object):
on_update: Any
def setdefault(self, key, default: Optional[Any] = ...): ...
def pop(self, key, default=...): ...
__setitem__: Any
__delitem__: Any
clear: Any
popitem: Any
update: Any
class TypeConversionDict(Dict[_K, _V]):
@overload
def get(self, key: _K, *, type: None = ...) -> Optional[_V]: ...
@overload
def get(self, key: _K, default: _D, type: None = ...) -> Union[_V, _D]: ...
@overload
def get(self, key: _K, *, type: Callable[[_V], _R]) -> Optional[_R]: ...
@overload
def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> Union[_R, _D]: ...
class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore
def copy(self) -> TypeConversionDict[_K, _V]: ...
def __copy__(self) -> ImmutableTypeConversionDict[_K, _V]: ...
class ViewItems:
def __init__(self, multi_dict, method, repr_name, *a, **kw): ...
def __iter__(self): ...
class MultiDict(TypeConversionDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __getitem__(self, key): ...
def __setitem__(self, key, value): ...
def add(self, key, value): ...
def getlist(self, key, type: Optional[Any] = ...): ...
def setlist(self, key, new_list): ...
def setdefault(self, key, default: Optional[Any] = ...): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
def items(self, multi: bool = ...): ...
def lists(self): ...
def keys(self): ...
__iter__: Any
def values(self): ...
def listvalues(self): ...
def copy(self): ...
def deepcopy(self, memo: Optional[Any] = ...): ...
def to_dict(self, flat: bool = ...): ...
def update(self, other_dict): ...
def pop(self, key, default=...): ...
def popitem(self): ...
def poplist(self, key): ...
def popitemlist(self): ...
def __copy__(self): ...
def __deepcopy__(self, memo): ...
class _omd_bucket:
prev: Any
key: Any
value: Any
next: Any
def __init__(self, omd, key, value): ...
def unlink(self, omd): ...
class OrderedMultiDict(MultiDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __reduce_ex__(self, protocol): ...
def __getitem__(self, key): ...
def __setitem__(self, key, value): ...
def __delitem__(self, key): ...
def keys(self): ...
__iter__: Any
def values(self): ...
def items(self, multi: bool = ...): ...
def lists(self): ...
def listvalues(self): ...
def add(self, key, value): ...
def getlist(self, key, type: Optional[Any] = ...): ...
def setlist(self, key, new_list): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
def update(self, mapping): ...
def poplist(self, key): ...
def pop(self, key, default=...): ...
def popitem(self): ...
def popitemlist(self): ...
class Headers(object):
def __init__(self, defaults: Optional[Any] = ...): ...
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]: ...
@overload
def get(self, key: str, default: _D, type: None = ...) -> Union[str, _D]: ...
@overload
def get(self, key: str, *, type: Callable[[str], _R]) -> Optional[_R]: ...
@overload
def get(self, key: str, default: _D, type: Callable[[str], _R]) -> Union[_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]: ...
@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_all(self, name): ...
def items(self, lower: bool = ...): ...
def keys(self, lower: bool = ...): ...
def values(self): ...
def extend(self, iterable): ...
def __delitem__(self, key: Any) -> None: ...
def remove(self, key): ...
def pop(self, **kwargs): ...
def popitem(self): ...
def __contains__(self, key): ...
has_key: Any
def __iter__(self): ...
def __len__(self): ...
def add(self, _key, _value, **kw): ...
def add_header(self, _key, _value, **_kw): ...
def clear(self): ...
def set(self, _key, _value, **kw): ...
def setdefault(self, key, value): ...
def __setitem__(self, key, value): ...
def to_list(self, charset: Text = ...): ...
def to_wsgi_list(self): ...
def copy(self): ...
def __copy__(self): ...
class ImmutableHeadersMixin:
def __delitem__(self, key: str) -> None: ...
def __setitem__(self, key, value): ...
set: Any
def add(self, *args, **kwargs): ...
remove: Any
add_header: Any
def extend(self, iterable): ...
def insert(self, pos, value): ...
def pop(self, **kwargs): ...
def popitem(self): ...
def setdefault(self, key, default): ...
class EnvironHeaders(ImmutableHeadersMixin, Headers):
environ: Any
def __init__(self, environ): ...
def __eq__(self, other): ...
def __getitem__(self, key, _get_mode: bool = ...): ...
def __len__(self): ...
def __iter__(self): ...
def copy(self): ...
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore
def __reduce_ex__(self, protocol): ...
dicts: Any
def __init__(self, dicts: Optional[Any] = ...): ...
@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 keys(self): ...
__iter__: Any
def items(self, multi: bool = ...): ...
def values(self): ...
def lists(self): ...
def listvalues(self): ...
def copy(self): ...
def to_dict(self, flat: bool = ...): ...
def __len__(self): ...
def __contains__(self, key): ...
has_key: Any
class FileMultiDict(MultiDict[_K, _V]):
def add_file(self, name, file, filename: Optional[Any] = ..., content_type: Optional[Any] = ...): ...
class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
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: SupportsIndex) -> 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) -> Optional[str]: ...
class MIMEAccept(Accept):
@property
def accept_html(self) -> bool: ...
@property
def accept_xhtml(self) -> bool: ...
@property
def accept_json(self) -> bool: ...
class LanguageAccept(Accept): ...
class CharsetAccept(Accept): ...
def cache_property(key, empty, type): ...
class _CacheControl(UpdateDictMixin, Dict[str, Any]):
no_cache: Any
no_store: Any
max_age: Any
no_transform: Any
on_update: Any
provided: Any
def __init__(self, values=..., on_update: Optional[Any] = ...): ...
def to_header(self): ...
class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore
max_stale: Any
min_fresh: Any
no_transform: Any
only_if_cached: Any
class ResponseCacheControl(_CacheControl):
public: Any
private: Any
must_revalidate: Any
proxy_revalidate: Any
s_maxage: Any
class CallbackDict(UpdateDictMixin, Dict[_K, _V]):
on_update: Any
def __init__(self, initial: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
class HeaderSet(MutableSet[str]):
on_update: Any
def __init__(self, headers: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def add(self, header): ...
def remove(self, header): ...
def update(self, iterable): ...
def discard(self, header): ...
def find(self, header): ...
def index(self, header): ...
def clear(self): ...
def as_set(self, preserve_casing: bool = ...): ...
def to_header(self): ...
def __getitem__(self, idx): ...
def __delitem__(self, idx): ...
def __setitem__(self, idx, value): ...
def __contains__(self, header): ...
def __len__(self): ...
def __iter__(self): ...
def __nonzero__(self): ...
class ETags(Container[str], Iterable[str]):
star_tag: Any
def __init__(self, strong_etags: Optional[Any] = ..., weak_etags: Optional[Any] = ..., 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 __bool__(self): ...
__nonzero__: Any
def __iter__(self): ...
def __contains__(self, etag): ...
class IfRange:
etag: Any
date: Any
def __init__(self, etag: Optional[Any] = ..., date: Optional[Any] = ...): ...
def to_header(self): ...
class Range:
units: Any
ranges: Any
def __init__(self, units, ranges): ...
def range_for_length(self, length): ...
def make_content_range(self, length): ...
def to_header(self): ...
def to_content_range_header(self, length): ...
class ContentRange:
on_update: Any
units: Optional[str]
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 unset(self) -> None: ...
def to_header(self): ...
def __nonzero__(self): ...
__bool__: Any
class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore
type: str
def __init__(self, auth_type: str, data: Optional[Mapping[str, Any]] = ...) -> None: ...
@property
def username(self) -> Optional[str]: ...
@property
def password(self) -> Optional[str]: ...
@property
def realm(self) -> Optional[str]: ...
@property
def nonce(self) -> Optional[str]: ...
@property
def uri(self) -> Optional[str]: ...
@property
def nc(self) -> Optional[str]: ...
@property
def cnonce(self) -> Optional[str]: ...
@property
def response(self) -> Optional[str]: ...
@property
def opaque(self) -> Optional[str]: ...
@property
def qop(self) -> Optional[str]: ...
class WWWAuthenticate(UpdateDictMixin, Dict[str, Any]):
on_update: Any
def __init__(self, auth_type: Optional[Any] = ..., values: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def set_basic(self, realm: str = ...): ...
def set_digest(
self, realm, nonce, qop=..., opaque: Optional[Any] = ..., algorithm: Optional[Any] = ..., stale: bool = ...
): ...
def to_header(self): ...
@staticmethod
def auth_property(name, doc: Optional[Any] = ...): ...
type: Any
realm: Any
domain: Any
nonce: Any
opaque: Any
algorithm: Any
qop: Any
stale: Any
class FileStorage(object):
name: Optional[Text]
stream: IO[bytes]
filename: Optional[Text]
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] = ...,
): ...
@property
def content_type(self) -> Optional[Text]: ...
@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 close(self) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def __getattr__(self, name: Text) -> Any: ...
def __iter__(self) -> Iterator[bytes]: ...
@@ -0,0 +1,51 @@
from typing import Any, Optional
from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response
PIN_TIME: Any
def hash_pin(pin): ...
def get_machine_id(): ...
class _ConsoleFrame:
console: Any
id: Any
def __init__(self, namespace): ...
def get_pin_and_cookie_name(app): ...
class DebuggedApplication:
app: Any
evalex: Any
frames: Any
tracebacks: Any
request_key: Any
console_path: Any
console_init_func: Any
show_hidden_frames: Any
secret: Any
pin_logging: Any
pin: Any
def __init__(
self,
app,
evalex: bool = ...,
request_key: str = ...,
console_path: str = ...,
console_init_func: Optional[Any] = ...,
show_hidden_frames: bool = ...,
lodgeit_url: Optional[Any] = ...,
pin_security: bool = ...,
pin_logging: bool = ...,
): ...
@property
def pin_cookie_name(self): ...
def debug_application(self, environ, start_response): ...
def execute_command(self, request, command, frame): ...
def display_console(self, request): ...
def paste_traceback(self, request, traceback): ...
def get_resource(self, request, filename): ...
def check_pin_trust(self, environ): ...
def pin_auth(self, request): ...
def log_pin_request(self): ...
def __call__(self, environ, start_response): ...
+44
View File
@@ -0,0 +1,44 @@
import code
from typing import Any, Optional
class HTMLStringO:
def __init__(self): ...
def isatty(self): ...
def close(self): ...
def flush(self): ...
def seek(self, n, mode: int = ...): ...
def readline(self): ...
def reset(self): ...
def write(self, x): ...
def writelines(self, x): ...
class ThreadedStream:
@staticmethod
def push(): ...
@staticmethod
def fetch(): ...
@staticmethod
def displayhook(obj): ...
def __setattr__(self, name, value): ...
def __dir__(self): ...
def __getattribute__(self, name): ...
class _ConsoleLoader:
def __init__(self): ...
def register(self, code, source): ...
def get_source_by_code(self, code): ...
class _InteractiveConsole(code.InteractiveInterpreter):
globals: Any
more: Any
buffer: Any
def __init__(self, globals, locals): ...
def runsource(self, source): ...
def runcode(self, code): ...
def showtraceback(self): ...
def showsyntaxerror(self, filename: Optional[Any] = ...): ...
def write(self, data): ...
class Console:
def __init__(self, globals: Optional[Any] = ..., locals: Optional[Any] = ...): ...
def eval(self, code): ...
+33
View File
@@ -0,0 +1,33 @@
from typing import Any, Optional
deque: Any
missing: Any
RegexType: Any
HELP_HTML: Any
OBJECT_DUMP_HTML: Any
def debug_repr(obj): ...
def dump(obj=...): ...
class _Helper:
def __call__(self, topic: Optional[Any] = ...): ...
helper: Any
class DebugReprGenerator:
def __init__(self): ...
list_repr: Any
tuple_repr: Any
set_repr: Any
frozenset_repr: Any
deque_repr: Any
def regex_repr(self, obj): ...
def string_repr(self, obj, limit: int = ...): ...
def dict_repr(self, d, recursive, limit: int = ...): ...
def object_repr(self, obj): ...
def dispatch_repr(self, obj, recursive): ...
def fallback_repr(self): ...
def repr(self, obj): ...
def dump_object(self, obj): ...
def dump_locals(self, d): ...
def render_object_dump(self, items, title, repr: Optional[Any] = ...): ...
+63
View File
@@ -0,0 +1,63 @@
from typing import Any, Optional
UTF8_COOKIE: Any
system_exceptions: Any
HEADER: Any
FOOTER: Any
PAGE_HTML: Any
CONSOLE_HTML: Any
SUMMARY_HTML: Any
FRAME_HTML: Any
SOURCE_LINE_HTML: Any
def render_console_html(secret, evalex_trusted: bool = ...): ...
def get_current_traceback(ignore_system_exceptions: bool = ..., show_hidden_frames: bool = ..., skip: int = ...): ...
class Line:
lineno: Any
code: Any
in_frame: Any
current: Any
def __init__(self, lineno, code): ...
def classes(self): ...
def render(self): ...
class Traceback:
exc_type: Any
exc_value: Any
exception_type: Any
frames: Any
def __init__(self, exc_type, exc_value, tb): ...
def filter_hidden_frames(self): ...
def is_syntax_error(self): ...
def exception(self): ...
def log(self, logfile: Optional[Any] = ...): ...
def paste(self): ...
def render_summary(self, include_title: bool = ...): ...
def render_full(self, evalex: bool = ..., secret: Optional[Any] = ..., evalex_trusted: bool = ...): ...
def generate_plaintext_traceback(self): ...
def plaintext(self): ...
id: Any
class Frame:
lineno: Any
function_name: Any
locals: Any
globals: Any
filename: Any
module: Any
loader: Any
code: Any
hide: Any
info: Any
def __init__(self, exc_type, exc_value, tb): ...
def render(self): ...
def render_line_context(self): ...
def get_annotated_lines(self): ...
def eval(self, code, mode: str = ...): ...
def sourcelines(self): ...
def get_context_lines(self, context: int = ...): ...
@property
def current_line(self): ...
def console(self): ...
id: Any
+183
View File
@@ -0,0 +1,183 @@
import datetime
from _typeshed.wsgi import StartResponse, WSGIEnvironment
from typing import Any, Dict, Iterable, List, NoReturn, Optional, Protocol, Text, Tuple, Type, Union
from werkzeug.wrappers import Response
class _EnvironContainer(Protocol):
@property
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: ...
@classmethod
def wrap(cls, exception: Type[Exception], name: Optional[str] = ...) -> 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 __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
default_exceptions: Dict[int, Type[HTTPException]]
class BadRequest(HTTPException):
code: int
description: Text
class ClientDisconnected(BadRequest): ...
class SecurityError(BadRequest): ...
class BadHost(BadRequest): ...
class Unauthorized(HTTPException):
code: int
description: Text
www_authenticate: Optional[Iterable[object]]
def __init__(
self,
description: Optional[Text] = ...,
response: Optional[Response] = ...,
www_authenticate: Union[None, Tuple[object, ...], List[object], object] = ...,
) -> None: ...
class Forbidden(HTTPException):
code: int
description: Text
class NotFound(HTTPException):
code: int
description: Text
class MethodNotAllowed(HTTPException):
code: int
description: Text
valid_methods: Any
def __init__(self, valid_methods: Optional[Any] = ..., description: Optional[Any] = ...): ...
class NotAcceptable(HTTPException):
code: int
description: Text
class RequestTimeout(HTTPException):
code: int
description: Text
class Conflict(HTTPException):
code: int
description: Text
class Gone(HTTPException):
code: int
description: Text
class LengthRequired(HTTPException):
code: int
description: Text
class PreconditionFailed(HTTPException):
code: int
description: Text
class RequestEntityTooLarge(HTTPException):
code: int
description: Text
class RequestURITooLarge(HTTPException):
code: int
description: Text
class UnsupportedMediaType(HTTPException):
code: int
description: Text
class RequestedRangeNotSatisfiable(HTTPException):
code: int
description: Text
length: Any
units: str
def __init__(self, length: Optional[Any] = ..., units: str = ..., description: Optional[Any] = ...): ...
class ExpectationFailed(HTTPException):
code: int
description: Text
class ImATeapot(HTTPException):
code: int
description: Text
class UnprocessableEntity(HTTPException):
code: int
description: Text
class Locked(HTTPException):
code: int
description: Text
class FailedDependency(HTTPException):
code: int
description: Text
class PreconditionRequired(HTTPException):
code: int
description: Text
class _RetryAfter(HTTPException):
retry_after: Union[None, int, datetime.datetime]
def __init__(
self,
description: Optional[Text] = ...,
response: Optional[Response] = ...,
retry_after: Union[None, int, datetime.datetime] = ...,
) -> None: ...
class TooManyRequests(_RetryAfter):
code: int
description: Text
class RequestHeaderFieldsTooLarge(HTTPException):
code: int
description: Text
class UnavailableForLegalReasons(HTTPException):
code: int
description: Text
class InternalServerError(HTTPException):
def __init__(
self, description: Optional[Text] = ..., response: Optional[Response] = ..., original_exception: Optional[Exception] = ...
) -> None: ...
code: int
description: Text
class NotImplemented(HTTPException):
code: int
description: Text
class BadGateway(HTTPException):
code: int
description: Text
class ServiceUnavailable(_RetryAfter):
code: int
description: Text
class GatewayTimeout(HTTPException):
code: int
description: Text
class HTTPVersionNotSupported(HTTPException):
code: int
description: Text
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 abort(status: Union[int, Response], *args: Any, **kwargs: Any) -> NoReturn: ...
class BadRequestKeyError(BadRequest, KeyError): ...
+7
View File
@@ -0,0 +1,7 @@
from typing import Any
has_likely_buggy_unicode_filesystem: Any
class BrokenFilesystemWarning(RuntimeWarning, UnicodeWarning): ...
def get_filesystem_encoding(): ...
+102
View File
@@ -0,0 +1,102 @@
from _typeshed.wsgi import WSGIEnvironment
from typing import (
IO,
Any,
Callable,
Dict,
Generator,
Iterable,
Mapping,
NoReturn,
Optional,
Protocol,
Text,
Tuple,
TypeVar,
Union,
)
from .datastructures import Headers
_Dict = Any
_ParseFunc = Callable[[IO[bytes], str, Optional[int], Mapping[str, str]], Tuple[IO[bytes], _Dict, _Dict]]
_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] = ...
) -> IO[bytes]: ...
def default_stream_factory(
total_content_length: Optional[int], filename: str, content_type: str, content_length: Optional[int] = ...
) -> IO[bytes]: ...
def parse_form_data(
environ: WSGIEnvironment,
stream_factory: Optional[_StreamFactory] = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
max_content_length: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
silent: bool = ...,
) -> Tuple[IO[bytes], _Dict, _Dict]: ...
def exhaust_stream(f: _F) -> _F: ...
class FormDataParser(object):
stream_factory: _StreamFactory
charset: Text
errors: Text
max_form_memory_size: Optional[int]
max_content_length: Optional[int]
cls: Callable[[], _Dict]
silent: bool
def __init__(
self,
stream_factory: Optional[_StreamFactory] = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
max_content_length: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
silent: bool = ...,
) -> None: ...
def get_parse_func(self, mimetype: str, options: Any) -> Optional[_ParseFunc]: ...
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]] = ...
) -> 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: ...
class MultiPartParser(object):
charset: Text
errors: Text
max_form_memory_size: Optional[int]
stream_factory: _StreamFactory
cls: Callable[[], _Dict]
buffer_size: int
def __init__(
self,
stream_factory: Optional[_StreamFactory] = ...,
charset: Text = ...,
errors: Text = ...,
max_form_memory_size: Optional[int] = ...,
cls: Optional[Callable[[], _Dict]] = ...,
buffer_size: int = ...,
) -> None: ...
def fail(self, message: Text) -> NoReturn: ...
def get_part_encoding(self, headers: Mapping[str, str]) -> Optional[str]: ...
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]
) -> Tuple[Text, IO[bytes]]: ...
def in_memory_threshold_reached(self, bytes: Any) -> NoReturn: ...
def validate_boundary(self, boundary: Optional[str]) -> 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]: ...
+137
View File
@@ -0,0 +1,137 @@
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 .datastructures import (
Accept,
Authorization,
ContentRange,
ETags,
Headers,
HeaderSet,
IfRange,
Range,
RequestCacheControl,
TypeConversionDict,
WWWAuthenticate,
)
if sys.version_info < (3,):
_Str = TypeVar("_Str", str, unicode)
_ToBytes = Union[bytes, bytearray, buffer, unicode]
_ETagData = Union[str, unicode, bytearray, buffer, memoryview]
else:
_Str = str
_ToBytes = Union[bytes, bytearray, memoryview, str]
_ETagData = Union[bytes, bytearray, memoryview]
_T = TypeVar("_T")
_U = TypeVar("_U")
HTTP_STATUS_CODES: Dict[int, str]
def wsgi_to_bytes(data: Union[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 parse_list_header(value: _Str) -> List[_Str]: ...
@overload
def parse_dict_header(value: Union[bytes, Text]) -> Dict[Text, Optional[Text]]: ...
@overload
def parse_dict_header(value: Union[bytes, Text], cls: Type[_T]) -> _T: ...
@overload
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, Dict[str, Optional[str]]]: ...
@overload
def parse_options_header(value: _Str) -> Tuple[_Str, Dict[_Str, Optional[_Str]]]: ...
# actually returns Tuple[_Str, Dict[_Str, Optional[_Str]], ...]
@overload
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[List[Tuple[str, float]]]], _T]) -> _T: ...
@overload
def parse_cache_control_header(
value: Union[None, bytes, Text], on_update: Optional[Callable[[RequestCacheControl], Any]] = ...
) -> RequestCacheControl: ...
@overload
def parse_cache_control_header(
value: Union[None, bytes, Text], on_update: _T, cls: Callable[[Dict[Text, Optional[Text]], _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_www_authenticate_header(
value: Union[None, bytes, Text], on_update: Optional[Callable[[WWWAuthenticate], Any]] = ...
) -> WWWAuthenticate: ...
def parse_if_range_header(value: Optional[Text]) -> IfRange: ...
def parse_range_header(value: Optional[Text], make_inclusive: bool = ...) -> Optional[Range]: ...
def parse_content_range_header(
value: Optional[Text], on_update: Optional[Callable[[ContentRange], Any]] = ...
) -> Optional[ContentRange]: ...
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 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 is_resource_modified(
environ: WSGIEnvironment,
etag: Optional[Text] = ...,
data: Optional[_ETagData] = ...,
last_modified: Union[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 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 = ...
) -> TypeConversionDict[Any, Any]: ...
@overload
def parse_cookie(
header: Union[None, WSGIEnvironment, Text, bytes],
charset: Text = ...,
errors: Text = ...,
cls: Optional[Callable[[Iterable[Tuple[Text, Text]]], _T]] = ...,
) -> _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] = ...,
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: ...
+100
View File
@@ -0,0 +1,100 @@
from typing import Any, Optional
def release_local(local): ...
class Local:
def __init__(self): ...
def __iter__(self): ...
def __call__(self, proxy): ...
def __release_local__(self): ...
def __getattr__(self, name): ...
def __setattr__(self, name, value): ...
def __delattr__(self, name): ...
class LocalStack:
def __init__(self): ...
def __release_local__(self): ...
def _get__ident_func__(self): ...
def _set__ident_func__(self, value): ...
__ident_func__: Any
def __call__(self): ...
def push(self, obj): ...
def pop(self): ...
@property
def top(self): ...
class LocalManager:
locals: Any
ident_func: Any
def __init__(self, locals: Optional[Any] = ..., ident_func: Optional[Any] = ...): ...
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] = ...): ...
@property
def __dict__(self): ...
def __bool__(self): ...
def __unicode__(self): ...
def __dir__(self): ...
def __getattr__(self, name): ...
def __setitem__(self, key, value): ...
def __delitem__(self, key): ...
__getslice__: Any
def __setslice__(self, i, j, seq): ...
def __delslice__(self, i, j): ...
__setattr__: Any
__delattr__: Any
__lt__: Any
__le__: Any
__eq__: Any
__ne__: Any
__gt__: Any
__ge__: Any
__cmp__: Any
__hash__: Any
__call__: Any
__len__: Any
__getitem__: Any
__iter__: Any
__contains__: Any
__add__: Any
__sub__: Any
__mul__: Any
__floordiv__: Any
__mod__: Any
__divmod__: Any
__pow__: Any
__lshift__: Any
__rshift__: Any
__and__: Any
__xor__: Any
__or__: Any
__div__: Any
__truediv__: Any
__neg__: Any
__pos__: Any
__abs__: Any
__invert__: Any
__complex__: Any
__int__: Any
__long__: Any
__float__: Any
__oct__: Any
__hex__: Any
__index__: Any
__coerce__: Any
__enter__: Any
__exit__: Any
__radd__: Any
__rsub__: Any
__rmul__: Any
__rdiv__: Any
__rtruediv__: Any
__rfloordiv__: Any
__rmod__: Any
__rdivmod__: Any
__copy__: Any
__deepcopy__: Any
@@ -0,0 +1,8 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Iterable, Mapping, Optional, Text
class DispatcherMiddleware(object):
app: WSGIApplication
mounts: Mapping[Text, WSGIApplication]
def __init__(self, app: WSGIApplication, mounts: Optional[Mapping[Text, WSGIApplication]] = ...) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -0,0 +1,14 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text
_Opts = Mapping[Text, Any]
_MutableOpts = MutableMapping[Text, Any]
class ProxyMiddleware(object):
app: WSGIApplication
targets: Dict[Text, _MutableOpts]
def __init__(
self, app: WSGIApplication, targets: Mapping[Text, _MutableOpts], chunk_size: int = ..., timeout: int = ...
) -> None: ...
def proxy_to(self, opts: _Opts, path: Text, prefix: Text) -> WSGIApplication: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -0,0 +1,62 @@
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 ..datastructures import Headers
class WSGIWarning(Warning): ...
class HTTPWarning(Warning): ...
def check_string(context: str, obj: object, stacklevel: int = ...) -> None: ...
class _SupportsReadEtc(Protocol):
def read(self, __size: int = ...) -> bytes: ...
def readline(self, __size: int = ...) -> bytes: ...
def __iter__(self) -> Iterator[bytes]: ...
def close(self) -> Any: ...
class InputStream(object):
def __init__(self, stream: _SupportsReadEtc) -> None: ...
def read(self, __size: int = ...) -> bytes: ...
def readline(self, __size: int = ...) -> bytes: ...
def __iter__(self) -> Iterator[bytes]: ...
def close(self) -> None: ...
class _SupportsWriteEtc(Protocol):
def write(self, __s: str) -> Any: ...
def flush(self) -> Any: ...
def close(self) -> Any: ...
class ErrorStream(object):
def __init__(self, stream: _SupportsWriteEtc) -> None: ...
def write(self, s: str) -> None: ...
def flush(self) -> None: ...
def writelines(self, seq: Iterable[str]) -> None: ...
def close(self) -> None: ...
class GuardedWrite(object):
def __init__(self, write: SupportsWrite[str], chunks: List[int]) -> None: ...
def __call__(self, s: str) -> None: ...
class GuardedIterator(object):
closed: bool
headers_set: bool
chunks: List[int]
def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: List[int]) -> None: ...
def __iter__(self) -> GuardedIterator: ...
if sys.version_info < (3,):
def next(self) -> str: ...
else:
def __next__(self) -> str: ...
def close(self) -> None: ...
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, ...]]
) -> 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: ...
@@ -0,0 +1,14 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
class ProfilerMiddleware(object):
def __init__(
self,
app: WSGIApplication,
stream: IO[str] = ...,
sort_by: Tuple[Text, Text] = ...,
restrictions: Iterable[Union[str, float]] = ...,
profile_dir: Optional[Text] = ...,
filename_format: Text = ...,
) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ...
@@ -0,0 +1,23 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Iterable, Optional
class ProxyFix(object):
app: WSGIApplication
x_for: int
x_proto: int
x_host: int
x_port: int
x_prefix: int
num_proxies: int
def __init__(
self,
app: WSGIApplication,
num_proxies: Optional[int] = ...,
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 __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@@ -0,0 +1,29 @@
import datetime
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union
_V = Union[Tuple[Text, Text], Text]
_Opener = Callable[[], Tuple[IO[bytes], datetime.datetime, int]]
_Loader = Callable[[Optional[Text]], Union[Tuple[None, None], Tuple[Text, _Opener]]]
class SharedDataMiddleware(object):
app: WSGIApplication
exports: List[Tuple[Text, _Loader]]
cache: bool
cache_timeout: float
def __init__(
self,
app: WSGIApplication,
exports: Union[Mapping[Text, _V], Iterable[Tuple[Text, _V]]],
disallow: Optional[Text] = ...,
cache: bool = ...,
cache_timeout: float = ...,
fallback_mimetype: Text = ...,
) -> None: ...
def is_allowed(self, filename: Text) -> bool: ...
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 __call__(self, environment: WSGIEnvironment, start_response: StartResponse) -> WSGIApplication: ...
@@ -0,0 +1,8 @@
from typing import Any
from ._compat import to_unicode as to_unicode
from .filesystem import get_filesystem_encoding as get_filesystem_encoding
can_rename_open_file: Any
def rename(src, dst): ...
+230
View File
@@ -0,0 +1,230 @@
from typing import Any, Optional, Text
from werkzeug.exceptions import HTTPException
def parse_converter_args(argstr): ...
def parse_rule(rule): ...
class RoutingException(Exception): ...
class RequestRedirect(HTTPException, RoutingException):
code: Any
new_url: Any
def __init__(self, new_url): ...
def get_response(self, environ): ...
class RequestSlash(RoutingException): ...
class RequestAliasRedirect(RoutingException):
matched_values: Any
def __init__(self, matched_values): ...
class BuildError(RoutingException, LookupError):
endpoint: Any
values: Any
method: Any
adapter: Optional[MapAdapter]
def __init__(self, endpoint, values, method, adapter: Optional[MapAdapter] = ...) -> None: ...
@property
def suggested(self) -> Optional[Rule]: ...
def closest_rule(self, adapter: Optional[MapAdapter]) -> Optional[Rule]: ...
class ValidationError(ValueError): ...
class RuleFactory:
def get_rules(self, map): ...
class Subdomain(RuleFactory):
subdomain: Any
rules: Any
def __init__(self, subdomain, rules): ...
def get_rules(self, map): ...
class Submount(RuleFactory):
path: Any
rules: Any
def __init__(self, path, rules): ...
def get_rules(self, map): ...
class EndpointPrefix(RuleFactory):
prefix: Any
rules: Any
def __init__(self, prefix, rules): ...
def get_rules(self, map): ...
class RuleTemplate:
rules: Any
def __init__(self, rules): ...
def __call__(self, *args, **kwargs): ...
class RuleTemplateFactory(RuleFactory):
rules: Any
context: Any
def __init__(self, rules, context): ...
def get_rules(self, map): ...
class Rule(RuleFactory):
rule: Any
is_leaf: Any
map: Any
strict_slashes: Any
subdomain: Any
host: Any
defaults: Any
build_only: Any
alias: Any
methods: Any
endpoint: Any
redirect_to: Any
arguments: Any
def __init__(
self,
string,
defaults: Optional[Any] = ...,
subdomain: Optional[Any] = ...,
methods: Optional[Any] = ...,
build_only: bool = ...,
endpoint: Optional[Any] = ...,
strict_slashes: Optional[Any] = ...,
redirect_to: Optional[Any] = ...,
alias: bool = ...,
host: Optional[Any] = ...,
): ...
def empty(self): ...
def get_empty_kwargs(self): ...
def get_rules(self, map): ...
def refresh(self): ...
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 build(self, values, append_unknown: bool = ...): ...
def provides_defaults_for(self, rule): ...
def suitable_for(self, values, method: Optional[Any] = ...): ...
def match_compare_key(self): ...
def build_compare_key(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
class BaseConverter:
regex: Any
weight: Any
map: Any
def __init__(self, map): ...
def to_python(self, value): ...
def to_url(self, value) -> str: ...
class UnicodeConverter(BaseConverter):
regex: Any
def __init__(self, map, minlength: int = ..., maxlength: Optional[Any] = ..., length: Optional[Any] = ...): ...
class AnyConverter(BaseConverter):
regex: Any
def __init__(self, map, *items): ...
class PathConverter(BaseConverter):
regex: Any
weight: Any
class NumberConverter(BaseConverter):
weight: Any
fixed_digits: Any
min: Any
max: Any
def __init__(self, map, fixed_digits: int = ..., min: Optional[Any] = ..., max: Optional[Any] = ...): ...
def to_python(self, value): ...
def to_url(self, value) -> str: ...
class IntegerConverter(NumberConverter):
regex: Any
num_convert: Any
class FloatConverter(NumberConverter):
regex: Any
num_convert: Any
def __init__(self, map, min: Optional[Any] = ..., max: Optional[Any] = ...): ...
class UUIDConverter(BaseConverter):
regex: Any
def to_python(self, value): ...
def to_url(self, value) -> str: ...
DEFAULT_CONVERTERS: Any
class Map:
default_converters: Any
default_subdomain: Any
charset: Text
encoding_errors: Text
strict_slashes: Any
redirect_defaults: Any
host_matching: Any
converters: Any
sort_parameters: Any
sort_key: Any
def __init__(
self,
rules: Optional[Any] = ...,
default_subdomain: str = ...,
charset: Text = ...,
strict_slashes: bool = ...,
redirect_defaults: bool = ...,
converters: Optional[Any] = ...,
sort_parameters: bool = ...,
sort_key: Optional[Any] = ...,
encoding_errors: Text = ...,
host_matching: bool = ...,
): ...
def is_endpoint_expecting(self, endpoint, *arguments): ...
def iter_rules(self, endpoint: Optional[Any] = ...): ...
def add(self, rulefactory): ...
def bind(
self,
server_name,
script_name: Optional[Any] = ...,
subdomain: Optional[Any] = ...,
url_scheme: str = ...,
default_method: str = ...,
path_info: Optional[Any] = ...,
query_args: Optional[Any] = ...,
): ...
def bind_to_environ(self, environ, server_name: Optional[Any] = ..., subdomain: Optional[Any] = ...): ...
def update(self): ...
class MapAdapter:
map: Any
server_name: Any
script_name: Any
subdomain: Any
url_scheme: Any
path_info: Any
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 = ...
): ...
def match(
self,
path_info: Optional[Any] = ...,
method: Optional[Any] = ...,
return_rule: bool = ...,
query_args: Optional[Any] = ...,
): ...
def test(self, path_info: Optional[Any] = ..., method: Optional[Any] = ...): ...
def allowed_methods(self, path_info: Optional[Any] = ...): ...
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_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 = ...,
): ...
+24
View File
@@ -0,0 +1,24 @@
from typing import Any, Optional
argument_types: Any
converters: Any
def run(namespace: Optional[Any] = ..., action_prefix: str = ..., args: Optional[Any] = ...): ...
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_runserver(
app_factory,
hostname: str = ...,
port: int = ...,
use_reloader: bool = ...,
use_debugger: bool = ...,
use_evalex: bool = ...,
threaded: bool = ...,
processes: int = ...,
static_files: Optional[Any] = ...,
extra_files: Optional[Any] = ...,
ssl_context: Optional[Any] = ...,
): ...
+12
View File
@@ -0,0 +1,12 @@
from typing import Any, Optional
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 safe_str_cmp(a, b): ...
def gen_salt(length): ...
def generate_password_hash(password, method: str = ..., salt_length: int = ...): ...
def check_password_hash(pwhash, password): ...
def safe_join(directory, filename): ...
+140
View File
@@ -0,0 +1,140 @@
import sys
from typing import Any, Optional
if sys.version_info < (3,):
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
else:
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
if sys.platform == "win32":
class ForkingMixIn(object): ...
else:
if sys.version_info < (3,):
from SocketServer import ForkingMixIn as ForkingMixIn
else:
from socketserver import ForkingMixIn as ForkingMixIn
class _SslDummy:
def __getattr__(self, name): ...
ssl: Any
LISTEN_QUEUE: Any
can_open_by_fd: Any
class WSGIRequestHandler(BaseHTTPRequestHandler):
@property
def server_version(self): ...
def make_environ(self): ...
environ: Any
close_connection: Any
def run_wsgi(self): ...
def handle(self): ...
def initiate_shutdown(self): ...
def connection_dropped(self, error, environ: Optional[Any] = ...): ...
raw_requestline: Any
def handle_one_request(self): ...
def send_response(self, code, message: Optional[Any] = ...): ...
def version_string(self): ...
def address_string(self): ...
def port_integer(self): ...
def log_request(self, code: object = ..., size: object = ...) -> None: ...
def log_error(self, *args): ...
def log_message(self, format, *args): ...
def log(self, type, message, *args): ...
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_context(): ...
def load_ssl_context(cert_file, pkey_file: Optional[Any] = ..., protocol: Optional[Any] = ...): ...
class _SSLContext:
def __init__(self, protocol): ...
def load_cert_chain(self, certfile, keyfile: Optional[Any] = ..., password: Optional[Any] = ...): ...
def wrap_socket(self, sock, **kwargs): ...
def is_ssl_error(error: Optional[Any] = ...): ...
def select_ip_version(host, port): ...
class BaseWSGIServer(HTTPServer):
multithread: Any
multiprocess: Any
request_queue_size: Any
address_family: Any
app: Any
passthrough_errors: Any
shutdown_signal: Any
host: Any
port: Any
socket: Any
server_address: Any
ssl_context: Any
def __init__(
self,
host,
port,
app,
handler: Optional[Any] = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
): ...
def log(self, type, message, *args): ...
def serve_forever(self): ...
def handle_error(self, request, client_address): ...
def get_request(self): ...
class ThreadedWSGIServer(ThreadingMixIn, BaseWSGIServer):
multithread: Any
daemon_threads: Any
class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer):
multiprocess: Any
max_children: Any
def __init__(
self,
host,
port,
app,
processes: int = ...,
handler: Optional[Any] = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
): ...
def make_server(
host: Optional[Any] = ...,
port: Optional[Any] = ...,
app: Optional[Any] = ...,
threaded: bool = ...,
processes: int = ...,
request_handler: Optional[Any] = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
fd: Optional[Any] = ...,
): ...
def is_running_from_reloader(): ...
def run_simple(
hostname,
port,
application,
use_reloader: bool = ...,
use_debugger: bool = ...,
use_evalex: bool = ...,
extra_files: Optional[Any] = ...,
reloader_interval: int = ...,
reloader_type: str = ...,
threaded: bool = ...,
processes: int = ...,
request_handler: Optional[Any] = ...,
static_files: Optional[Any] = ...,
passthrough_errors: bool = ...,
ssl_context: Optional[Any] = ...,
): ...
def run_with_reloader(*args, **kwargs): ...
def main(): ...
+175
View File
@@ -0,0 +1,175 @@
import sys
from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
if sys.version_info < (3,):
from cookielib import CookieJar
from urllib2 import Request as U2Request
else:
from http.cookiejar import CookieJar
from urllib.request 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] = ...): ...
class _TestCookieHeaders:
headers: Any
def __init__(self, headers): ...
def getheaders(self, name): ...
def get_all(self, name, default: Optional[Any] = ...): ...
class _TestCookieResponse:
headers: Any
def __init__(self, headers): ...
def info(self): ...
class _TestCookieJar(CookieJar):
def inject_wsgi(self, environ): ...
def extract_wsgi(self, environ, headers): ...
class EnvironBuilder:
server_protocol: Any
wsgi_version: Any
request_class: Any
charset: Text
path: Any
base_url: Any
query_string: Any
args: Any
method: Any
headers: Any
content_type: Any
errors_stream: Any
multithread: Any
multiprocess: Any
run_once: Any
environ_base: Any
environ_overrides: Any
input_stream: Any
content_length: Any
closed: Any
def __init__(
self,
path: str = ...,
base_url: Optional[Any] = ...,
query_string: Optional[Any] = ...,
method: str = ...,
input_stream: Optional[Any] = ...,
content_type: Optional[Any] = ...,
content_length: Optional[Any] = ...,
errors_stream: Optional[Any] = ...,
multithread: bool = ...,
multiprocess: bool = ...,
run_once: bool = ...,
headers: Optional[Any] = ...,
data: Optional[Any] = ...,
environ_base: Optional[Any] = ...,
environ_overrides: Optional[Any] = ...,
charset: Text = ...,
): ...
form: Any
files: Any
@property
def server_name(self) -> str: ...
@property
def server_port(self) -> int: ...
def __del__(self) -> None: ...
def close(self) -> None: ...
def get_environ(self) -> WSGIEnvironment: ...
def get_request(self, cls: Optional[Any] = ...): ...
class ClientRedirectError(Exception): ...
# Response type for the client below.
# By default _R is Tuple[Iterable[Any], Union[Text, int], datastructures.Headers]
_R = TypeVar("_R")
class Client(Generic[_R]):
application: Any
response_wrapper: Optional[Type[_R]]
cookie_jar: Any
allow_subdomain_redirects: Any
def __init__(
self,
application,
response_wrapper: Optional[Type[_R]] = ...,
use_cookies: bool = ...,
allow_subdomain_redirects: bool = ...,
): ...
def set_cookie(
self,
server_name,
key,
value: str = ...,
max_age: Optional[Any] = ...,
expires: Optional[Any] = ...,
path: str = ...,
domain: Optional[Any] = ...,
secure: Optional[Any] = ...,
httponly: bool = ...,
charset: Text = ...,
): ...
def delete_cookie(self, server_name, key, path: str = ..., domain: Optional[Any] = ...): ...
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]: ...
@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]: ...
@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]: ...
@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]: ...
@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]: ...
@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]: ...
@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]: ...
@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]: ...
@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]: ...
@overload
def trace(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
@overload
def trace(self, *args, as_tuple: bool, **kw) -> Any: ...
def create_environ(*args, **kwargs): ...
def run_wsgi_app(app, environ, buffered: bool = ...): ...
+10
View File
@@ -0,0 +1,10 @@
from typing import Any
from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response
logo: Any
TEMPLATE: Any
def iter_sys_path(): ...
def render_testapp(req): ...
def test_app(environ, start_response): ...
+94
View File
@@ -0,0 +1,94 @@
from typing import Any, NamedTuple, Optional, Text
class _URLTuple(NamedTuple):
scheme: Any
netloc: Any
path: Any
query: Any
fragment: Any
class BaseURL(_URLTuple):
def replace(self, **kwargs): ...
@property
def host(self): ...
@property
def ascii_host(self): ...
@property
def port(self): ...
@property
def auth(self): ...
@property
def username(self): ...
@property
def raw_username(self): ...
@property
def password(self): ...
@property
def raw_password(self): ...
def decode_query(self, *args, **kwargs): ...
def join(self, *args, **kwargs): ...
def to_url(self): ...
def decode_netloc(self): ...
def to_uri_tuple(self): ...
def to_iri_tuple(self): ...
def get_file_location(self, pathformat: Optional[Any] = ...): ...
class URL(BaseURL):
def encode_netloc(self): ...
def encode(self, charset: Text = ..., errors: Text = ...): ...
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_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): ...
def url_unquote(string, charset: Text = ..., errors: Text = ..., unsafe: str = ...): ...
def url_unquote_plus(s, charset: Text = ..., errors: Text = ...): ...
def url_fix(s, charset: Text = ...): ...
def uri_to_iri(uri, charset: Text = ..., errors: Text = ...): ...
def iri_to_uri(iri, charset: Text = ..., errors: Text = ..., safe_conversion: bool = ...): ...
def url_decode(
s,
charset: Text = ...,
decode_keys: bool = ...,
include_empty: bool = ...,
errors: Text = ...,
separator: str = ...,
cls: Optional[Any] = ...,
): ...
def url_decode_stream(
stream,
charset: Text = ...,
decode_keys: bool = ...,
include_empty: bool = ...,
errors: Text = ...,
separator: str = ...,
cls: Optional[Any] = ...,
limit: Optional[Any] = ...,
return_iterator: bool = ...,
): ...
def url_encode(
obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Optional[Any] = ..., separator: bytes = ...
): ...
def url_encode_stream(
obj,
stream: Optional[Any] = ...,
charset: Text = ...,
encode_keys: bool = ...,
sort: bool = ...,
key: Optional[Any] = ...,
separator: bytes = ...,
): ...
def url_join(base, url, allow_fragments: bool = ...): ...
class Href:
base: Any
charset: Text
sort: Any
key: Any
def __init__(self, base: str = ..., charset: Text = ..., sort: bool = ..., key: Optional[Any] = ...): ...
def __getattr__(self, name): ...
def __call__(self, *path, **query): ...
+18
View File
@@ -0,0 +1,18 @@
from typing import Any, Optional
class UserAgentParser:
platforms: Any
browsers: Any
def __init__(self): ...
def __call__(self, user_agent): ...
class UserAgent:
string: Any
platform: Optional[str]
browser: Optional[str]
version: Optional[str]
language: Optional[str]
def __init__(self, environ_or_string): ...
def to_header(self): ...
def __nonzero__(self): ...
__bool__: Any
+58
View File
@@ -0,0 +1,58 @@
from typing import Any, Optional, Text, Type, TypeVar, overload
from werkzeug._internal import _DictAccessorProperty
from werkzeug.wrappers import Response
class cached_property(property):
__name__: Any
__module__: Any
__doc__: Any
func: Any
def __init__(self, func, name: Optional[Any] = ..., doc: Optional[Any] = ...): ...
def __set__(self, obj, value): ...
def __get__(self, obj, type: Optional[Any] = ...): ...
class environ_property(_DictAccessorProperty):
read_only: Any
def lookup(self, obj): ...
class header_property(_DictAccessorProperty):
def lookup(self, obj): ...
class HTMLBuilder:
def __init__(self, dialect): ...
def __call__(self, s): ...
def __getattr__(self, tag): ...
html: Any
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 unescape(s): ...
# 'redirect' returns a werkzeug Response, unless you give it
# another Response type to use instead.
_RC = TypeVar("_RC", bound=Response)
@overload
def redirect(location, code: int = ..., Response: None = ...) -> Response: ...
@overload
def redirect(location, code: int = ..., Response: Type[_RC] = ...) -> _RC: ...
def append_slash_redirect(environ, code: int = ...): ...
def import_string(import_name, silent: bool = ...): ...
def find_modules(import_path, include_packages: bool = ..., recursive: bool = ...): ...
def validate_arguments(func, args, kwargs, drop_extra: bool = ...): ...
def bind_arguments(func, args, kwargs): ...
class ArgumentValidationError(ValueError):
missing: Any
extra: Any
extra_positional: Any
def __init__(self, missing: Optional[Any] = ..., extra: Optional[Any] = ..., extra_positional: Optional[Any] = ...): ...
class ImportStringError(ImportError):
import_name: Any
exception: Any
def __init__(self, import_name, exception): ...
+289
View File
@@ -0,0 +1,289 @@
from _typeshed.wsgi import InputStream, WSGIEnvironment
from datetime import datetime
from typing import (
Any,
Callable,
Iterable,
Iterator,
Mapping,
MutableMapping,
Optional,
Sequence,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing_extensions import Literal
from .datastructures import (
Accept,
Authorization,
CharsetAccept,
CombinedMultiDict,
EnvironHeaders,
Headers,
HeaderSet,
ImmutableMultiDict,
ImmutableTypeConversionDict,
LanguageAccept,
MIMEAccept,
MultiDict,
)
from .useragents import UserAgent
class BaseRequest:
charset: str
encoding_errors: str
max_content_length: Optional[int]
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]]
disable_data_descriptor: Any
environ: WSGIEnvironment = ...
shallow: Any
def __init__(self, environ: WSGIEnvironment, populate_request: bool = ..., shallow: bool = ...) -> None: ...
@property
def url_charset(self) -> str: ...
@classmethod
def from_values(cls, *args, **kwargs) -> BaseRequest: ...
@classmethod
def application(cls, f): ...
@property
def want_form_data_parsed(self): ...
def make_form_data_parser(self): ...
def close(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, tb): ...
@property
def stream(self) -> InputStream: ...
input_stream: InputStream
args: ImmutableMultiDict[Any, Any]
@property
def data(self) -> bytes: ...
@overload
def get_data(self, cache: bool = ..., as_text: Literal[False] = ..., parse_form_data: bool = ...) -> bytes: ...
@overload
def get_data(self, cache: bool, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ...
@overload
def get_data(self, *, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ...
@overload
def get_data(self, cache: bool, as_text: bool, parse_form_data: bool = ...) -> Any: ...
@overload
def get_data(self, *, as_text: bool, parse_form_data: bool = ...) -> Any: ...
form: ImmutableMultiDict[Any, Any]
values: CombinedMultiDict[Any, Any]
files: MultiDict[Any, Any]
@property
def cookies(self) -> ImmutableTypeConversionDict[str, str]: ...
headers: EnvironHeaders
path: Text
full_path: Text
script_root: Text
url: Text
base_url: Text
url_root: Text
host_url: Text
host: Text
query_string: bytes
method: Text
@property
def access_route(self) -> Sequence[str]: ...
@property
def remote_addr(self) -> str: ...
remote_user: Text
scheme: str
is_xhr: bool
is_secure: bool
is_multithread: bool
is_multiprocess: bool
is_run_once: bool
_OnCloseT = TypeVar("_OnCloseT", bound=Callable[[], Any])
_SelfT = TypeVar("_SelfT", bound=BaseResponse)
class BaseResponse:
charset: str
default_status: int
default_mimetype: Optional[str]
implicit_sequence_conversion: bool
autocorrect_location_header: bool
automatically_set_content_length: bool
headers: Headers
status_code: int
status: str
direct_passthrough: bool
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] = ...,
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: ...
@classmethod
def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ...
@overload
def get_data(self, as_text: Literal[False] = ...) -> bytes: ...
@overload
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: ...
data: Any
def calculate_content_length(self) -> Optional[int]: ...
def make_sequence(self) -> None: ...
def iter_encoded(self) -> Iterator[bytes]: ...
def set_cookie(
self,
key: str,
value: Union[str, bytes] = ...,
max_age: Optional[int] = ...,
expires: Optional[int] = ...,
path: str = ...,
domain: Optional[str] = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: Optional[str] = ...,
) -> None: ...
def delete_cookie(self, key, path: str = ..., domain: Optional[Any] = ...): ...
@property
def is_streamed(self) -> bool: ...
@property
def is_sequence(self) -> bool: ...
def close(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, tb): ...
# The no_etag argument if fictional, but required for compatibility with
# ETagResponseMixin
def freeze(self, no_etag: bool = ...) -> None: ...
def get_wsgi_headers(self, environ): ...
def get_app_iter(self, environ): ...
def get_wsgi_response(self, environ): ...
def __call__(self, environ, start_response): ...
class AcceptMixin(object):
@property
def accept_mimetypes(self) -> MIMEAccept: ...
@property
def accept_charsets(self) -> CharsetAccept: ...
@property
def accept_encodings(self) -> Accept: ...
@property
def accept_languages(self) -> LanguageAccept: ...
class ETagRequestMixin:
@property
def cache_control(self): ...
@property
def if_match(self): ...
@property
def if_none_match(self): ...
@property
def if_modified_since(self): ...
@property
def if_unmodified_since(self): ...
@property
def if_range(self): ...
@property
def range(self): ...
class UserAgentMixin:
@property
def user_agent(self) -> UserAgent: ...
class AuthorizationMixin:
@property
def authorization(self) -> Optional[Authorization]: ...
class StreamOnlyMixin:
disable_data_descriptor: Any
want_form_data_parsed: Any
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 add_etag(self, overwrite: bool = ..., weak: bool = ...): ...
def set_etag(self, etag, weak: bool = ...): ...
def get_etag(self): ...
def freeze(self, no_etag: bool = ...) -> None: ...
accept_ranges: Any
content_range: Any
class ResponseStream:
mode: Any
response: Any
closed: Any
def __init__(self, response): ...
def write(self, value): ...
def writelines(self, seq): ...
def close(self): ...
def flush(self): ...
def isatty(self): ...
@property
def encoding(self): ...
class ResponseStreamMixin:
@property
def stream(self) -> ResponseStream: ...
class CommonRequestDescriptorsMixin:
@property
def content_type(self) -> Optional[str]: ...
@property
def content_length(self) -> Optional[int]: ...
@property
def content_encoding(self) -> Optional[str]: ...
@property
def content_md5(self) -> Optional[str]: ...
@property
def referrer(self) -> Optional[str]: ...
@property
def date(self) -> Optional[datetime]: ...
@property
def max_forwards(self) -> Optional[int]: ...
@property
def mimetype(self) -> str: ...
@property
def mimetype_params(self) -> Mapping[str, str]: ...
@property
def pragma(self) -> HeaderSet: ...
class CommonResponseDescriptorsMixin:
mimetype: Optional[str] = ...
@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] = ...
class WWWAuthenticateMixin:
@property
def www_authenticate(self): ...
class Request(BaseRequest, AcceptMixin, ETagRequestMixin, UserAgentMixin, AuthorizationMixin, CommonRequestDescriptorsMixin): ...
class PlainRequest(StreamOnlyMixin, Request): ...
class Response(BaseResponse, ETagResponseMixin, ResponseStreamMixin, CommonResponseDescriptorsMixin, WWWAuthenticateMixin): ...
+74
View File
@@ -0,0 +1,74 @@
from _typeshed import SupportsRead
from _typeshed.wsgi import InputStream, WSGIEnvironment
from typing import Any, Iterable, Optional, Text
from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware
from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware
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] = ...
): ...
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_input_stream(environ: WSGIEnvironment, safe_fallback: bool = ...) -> InputStream: ...
def get_query_string(environ): ...
def get_path_info(environ, charset: Text = ..., errors: Text = ...): ...
def get_script_name(environ, charset: Text = ..., errors: Text = ...): ...
def pop_path_info(environ, charset: Text = ..., errors: Text = ...): ...
def peek_path_info(environ, charset: Text = ..., errors: Text = ...): ...
def extract_path_info(
environ_or_baseurl, path_or_url, charset: Text = ..., errors: Text = ..., collapse_http_schemes: bool = ...
): ...
class ClosingIterator:
def __init__(self, iterable, callbacks: Optional[Any] = ...): ...
def __iter__(self): ...
def __next__(self): ...
def close(self): ...
def wrap_file(environ: WSGIEnvironment, file: SupportsRead[bytes], buffer_size: int = ...) -> Iterable[bytes]: ...
class FileWrapper:
file: SupportsRead[bytes]
buffer_size: int
def __init__(self, file: SupportsRead[bytes], buffer_size: int = ...) -> None: ...
def close(self) -> None: ...
def seekable(self) -> bool: ...
def seek(self, offset: int, whence: int = ...) -> None: ...
def tell(self) -> Optional[int]: ...
def __iter__(self) -> FileWrapper: ...
def __next__(self) -> bytes: ...
class _RangeWrapper:
iterable: Any
byte_range: Any
start_byte: Any
end_byte: Any
read_length: Any
seekable: Any
end_reached: Any
def __init__(self, iterable, start_byte: int = ..., byte_range: Optional[Any] = ...): ...
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 = ...): ...
class LimitedStream:
limit: Any
def __init__(self, stream, limit): ...
def __iter__(self): ...
@property
def is_exhausted(self): ...
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 tell(self): ...
def __next__(self): ...