mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Improve werkzeug stubs (#1730)
This commit is contained in:
committed by
Łukasz Langa
parent
4563c5a1ac
commit
0c15e5bdcc
72
third_party/2/werkzeug/wrappers.pyi
vendored
72
third_party/2/werkzeug/wrappers.pyi
vendored
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime
|
||||
from typing import (
|
||||
Any, Iterable, Mapping, MutableMapping, Optional, Sequence, Tuple, Type,
|
||||
Union,
|
||||
Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Text,
|
||||
Tuple, Type, TypeVar, Union,
|
||||
)
|
||||
|
||||
from wsgiref.types import WSGIEnvironment
|
||||
@@ -14,13 +14,13 @@ from .datastructures import (
|
||||
class BaseRequest:
|
||||
charset = ... # type: str
|
||||
encoding_errors = ... # type: str
|
||||
max_content_length = ... # type: Union[int, long]
|
||||
max_form_memory_size = ... # type: Union[int, long]
|
||||
max_content_length = ... # type: int
|
||||
max_form_memory_size = ... # type: int
|
||||
parameter_storage_class = ... # type: Type
|
||||
list_storage_class = ... # type: Type
|
||||
dict_storage_class = ... # type: Type
|
||||
form_data_parser_class = ... # type: Type
|
||||
trusted_hosts = ... # type: Optional[Sequence[unicode]]
|
||||
trusted_hosts = ... # type: Optional[Sequence[Text]]
|
||||
disable_data_descriptor = ... # type: Any
|
||||
environ: WSGIEnvironment = ...
|
||||
shallow = ... # type: Any
|
||||
@@ -41,27 +41,27 @@ class BaseRequest:
|
||||
input_stream = ... # type: Any
|
||||
args = ... # type: ImmutableMultiDict
|
||||
@property
|
||||
def data(self) -> str: ...
|
||||
def get_data(self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ...) -> str: ...
|
||||
def data(self) -> bytes: ...
|
||||
def get_data(self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ...) -> bytes: ...
|
||||
form = ... # type: ImmutableMultiDict
|
||||
values = ... # type: CombinedMultiDict
|
||||
files = ... # type: MultiDict
|
||||
cookies = ... # type: TypeConversionDict
|
||||
headers = ... # type: EnvironHeaders
|
||||
path = ... # type: unicode
|
||||
full_path = ... # type: unicode
|
||||
script_root = ... # type: unicode
|
||||
url = ... # type: unicode
|
||||
base_url = ... # type: unicode
|
||||
url_root = ... # type: unicode
|
||||
host_url = ... # type: unicode
|
||||
host = ... # type: unicode
|
||||
query_string = ... # type: str
|
||||
method = ... # type: str
|
||||
path = ... # type: Text
|
||||
full_path = ... # type: Text
|
||||
script_root = ... # type: Text
|
||||
url = ... # type: Text
|
||||
base_url = ... # type: Text
|
||||
url_root = ... # type: Text
|
||||
host_url = ... # type: Text
|
||||
host = ... # type: Text
|
||||
query_string = ... # type: bytes
|
||||
method = ... # type: Text
|
||||
def access_route(self): ...
|
||||
@property
|
||||
def remote_addr(self) -> str: ...
|
||||
remote_user = ... # type: unicode
|
||||
remote_user = ... # type: Text
|
||||
scheme = ... # type: str
|
||||
is_xhr = ... # type: bool
|
||||
is_secure = ... # type: bool
|
||||
@@ -69,6 +69,9 @@ class BaseRequest:
|
||||
is_multiprocess = ... # type: bool
|
||||
is_run_once = ... # type: bool
|
||||
|
||||
_OnCloseT = TypeVar('_OnCloseT', bound=Callable[[], Any])
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseResponse)
|
||||
|
||||
class BaseResponse:
|
||||
charset = ... # type: str
|
||||
default_status = ... # type: int
|
||||
@@ -80,27 +83,26 @@ class BaseResponse:
|
||||
status_code = ... # type: int
|
||||
status = ... # type: str
|
||||
direct_passthrough = ... # type: bool
|
||||
response = ... # type: Iterable[str]
|
||||
def __init__(self,
|
||||
response: Optional[Union[Iterable[str], str]] = ...,
|
||||
status: Optional[Union[basestring, int]] = ...,
|
||||
response = ... # type: Iterable[bytes]
|
||||
def __init__(self, response: Optional[Union[Iterable[bytes], bytes]] = ...,
|
||||
status: Optional[Union[Text, int]] = ...,
|
||||
headers: Optional[Union[Headers,
|
||||
Mapping[basestring, basestring],
|
||||
Sequence[Tuple[basestring, basestring]]]] = None,
|
||||
mimetype: Optional[basestring] = ...,
|
||||
content_type: Optional[basestring] = ...,
|
||||
direct_passthrough: Optional[bool] = ...) -> None: ...
|
||||
def call_on_close(self, func): ...
|
||||
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, response, environ=None): ...
|
||||
def force_type(cls: Type[_SelfT], response: object, environ: Optional[WSGIEnvironment] = ...) -> _SelfT: ...
|
||||
@classmethod
|
||||
def from_app(cls, app, environ, buffered=False): ...
|
||||
def get_data(self, as_text=False): ...
|
||||
def set_data(self, value): ...
|
||||
def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ...
|
||||
def get_data(self, as_text: bool = ...) -> Any: ... # returns bytes if as_text is False (the default), else Text
|
||||
def set_data(self, value: Union[bytes, Text]) -> None: ...
|
||||
data = ... # type: Any
|
||||
def calculate_content_length(self): ...
|
||||
def make_sequence(self): ...
|
||||
def iter_encoded(self): ...
|
||||
def calculate_content_length(self) -> Optional[int]: ...
|
||||
def make_sequence(self) -> None: ...
|
||||
def iter_encoded(self) -> Iterator[bytes]: ...
|
||||
def set_cookie(self, key, value='', max_age=None, expires=None, path='', domain=None, secure=False, httponly=False): ...
|
||||
def delete_cookie(self, key, path='', domain=None): ...
|
||||
@property
|
||||
|
||||
54
third_party/3/werkzeug/wrappers.pyi
vendored
54
third_party/3/werkzeug/wrappers.pyi
vendored
@@ -1,7 +1,6 @@
|
||||
from datetime import datetime
|
||||
from typing import (
|
||||
Any, Iterable, Mapping, MutableMapping, Optional, Sequence, Tuple, Type,
|
||||
Union,
|
||||
Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Text, Tuple, Type, TypeVar, Union,
|
||||
)
|
||||
|
||||
from wsgiref.types import WSGIEnvironment
|
||||
@@ -20,7 +19,7 @@ class BaseRequest:
|
||||
list_storage_class = ... # type: Type
|
||||
dict_storage_class = ... # type: Type
|
||||
form_data_parser_class = ... # type: Type
|
||||
trusted_hosts = ... # type: Optional[Sequence[str]]
|
||||
trusted_hosts = ... # type: Optional[Sequence[Text]]
|
||||
disable_data_descriptor = ... # type: Any
|
||||
environ: WSGIEnvironment = ...
|
||||
shallow = ... # type: Any
|
||||
@@ -48,20 +47,20 @@ class BaseRequest:
|
||||
files = ... # type: MultiDict
|
||||
cookies = ... # type: TypeConversionDict
|
||||
headers = ... # type: EnvironHeaders
|
||||
path = ... # type: str
|
||||
full_path = ... # type: str
|
||||
script_root = ... # type: str
|
||||
url = ... # type: str
|
||||
base_url = ... # type: str
|
||||
url_root = ... # type: str
|
||||
host_url = ... # type: str
|
||||
host = ... # type: str
|
||||
path = ... # type: Text
|
||||
full_path = ... # type: Text
|
||||
script_root = ... # type: Text
|
||||
url = ... # type: Text
|
||||
base_url = ... # type: Text
|
||||
url_root = ... # type: Text
|
||||
host_url = ... # type: Text
|
||||
host = ... # type: Text
|
||||
query_string = ... # type: bytes
|
||||
method = ... # type: str
|
||||
method = ... # type: Text
|
||||
def access_route(self): ...
|
||||
@property
|
||||
def remote_addr(self) -> str: ...
|
||||
remote_user = ... # type: str
|
||||
remote_user = ... # type: Text
|
||||
scheme = ... # type: str
|
||||
is_xhr = ... # type: bool
|
||||
is_secure = ... # type: bool
|
||||
@@ -69,6 +68,9 @@ class BaseRequest:
|
||||
is_multiprocess = ... # type: bool
|
||||
is_run_once = ... # type: bool
|
||||
|
||||
_OnCloseT = TypeVar('_OnCloseT', bound=Callable[[], Any])
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseResponse)
|
||||
|
||||
class BaseResponse:
|
||||
charset = ... # type: str
|
||||
default_status = ... # type: int
|
||||
@@ -82,24 +84,24 @@ class BaseResponse:
|
||||
direct_passthrough = ... # type: bool
|
||||
response = ... # type: Iterable[bytes]
|
||||
def __init__(self, response: Optional[Union[Iterable[bytes], bytes]] = ...,
|
||||
status: Optional[Union[str, int]] = ...,
|
||||
status: Optional[Union[Text, int]] = ...,
|
||||
headers: Optional[Union[Headers,
|
||||
Mapping[str, str],
|
||||
Sequence[Tuple[str, str]]]]=None,
|
||||
mimetype: Optional[str] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
Mapping[Text, Text],
|
||||
Sequence[Tuple[Text, Text]]]] = ...,
|
||||
mimetype: Optional[Text] = ...,
|
||||
content_type: Optional[Text] = ...,
|
||||
direct_passthrough: bool = ...) -> None: ...
|
||||
def call_on_close(self, func): ...
|
||||
def call_on_close(self, func: _OnCloseT) -> _OnCloseT: ...
|
||||
@classmethod
|
||||
def force_type(cls, response, environ=None): ...
|
||||
def force_type(cls: Type[_SelfT], response: object, environ: Optional[WSGIEnvironment] = ...) -> _SelfT: ...
|
||||
@classmethod
|
||||
def from_app(cls, app, environ, buffered=False): ...
|
||||
def get_data(self, as_text=False): ...
|
||||
def set_data(self, value): ...
|
||||
def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ...
|
||||
def get_data(self, as_text: bool = ...) -> Any: ... # returns bytes if as_text is False (the default), else Text
|
||||
def set_data(self, value: Union[bytes, Text]) -> None: ...
|
||||
data = ... # type: Any
|
||||
def calculate_content_length(self): ...
|
||||
def make_sequence(self): ...
|
||||
def iter_encoded(self): ...
|
||||
def calculate_content_length(self) -> Optional[int]: ...
|
||||
def make_sequence(self) -> None: ...
|
||||
def iter_encoded(self) -> Iterator[bytes]: ...
|
||||
def set_cookie(self, key, value='', max_age=None, expires=None, path='', domain=None, secure=False, httponly=False): ...
|
||||
def delete_cookie(self, key, path='', domain=None): ...
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user