massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / Werkzeug / werkzeug / wrappers.pyi
1 from _typeshed.wsgi import InputStream, WSGIEnvironment
2 from datetime import datetime, timedelta
3 from typing import Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence, Text, Type, TypeVar, overload
4 from typing_extensions import Literal
5
6 from .datastructures import (
7     Accept,
8     Authorization,
9     CharsetAccept,
10     CombinedMultiDict,
11     EnvironHeaders,
12     Headers,
13     HeaderSet,
14     ImmutableMultiDict,
15     ImmutableTypeConversionDict,
16     LanguageAccept,
17     MIMEAccept,
18     MultiDict,
19 )
20 from .useragents import UserAgent
21
22 class BaseRequest:
23     charset: str
24     encoding_errors: str
25     max_content_length: int | None
26     max_form_memory_size: int
27     parameter_storage_class: Type[Any]
28     list_storage_class: Type[Any]
29     dict_storage_class: Type[Any]
30     form_data_parser_class: Type[Any]
31     trusted_hosts: Sequence[Text] | None
32     disable_data_descriptor: Any
33     environ: WSGIEnvironment = ...
34     shallow: Any
35     def __init__(self, environ: WSGIEnvironment, populate_request: bool = ..., shallow: bool = ...) -> None: ...
36     @property
37     def url_charset(self) -> str: ...
38     @classmethod
39     def from_values(cls, *args, **kwargs) -> BaseRequest: ...
40     @classmethod
41     def application(cls, f): ...
42     @property
43     def want_form_data_parsed(self): ...
44     def make_form_data_parser(self): ...
45     def close(self) -> None: ...
46     def __enter__(self): ...
47     def __exit__(self, exc_type, exc_value, tb): ...
48     @property
49     def stream(self) -> InputStream: ...
50     input_stream: InputStream
51     args: ImmutableMultiDict[Any, Any]
52     @property
53     def data(self) -> bytes: ...
54     @overload
55     def get_data(self, cache: bool = ..., as_text: Literal[False] = ..., parse_form_data: bool = ...) -> bytes: ...
56     @overload
57     def get_data(self, cache: bool, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ...
58     @overload
59     def get_data(self, *, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ...
60     @overload
61     def get_data(self, cache: bool, as_text: bool, parse_form_data: bool = ...) -> Any: ...
62     @overload
63     def get_data(self, *, as_text: bool, parse_form_data: bool = ...) -> Any: ...
64     form: ImmutableMultiDict[Any, Any]
65     values: CombinedMultiDict[Any, Any]
66     files: MultiDict[Any, Any]
67     @property
68     def cookies(self) -> ImmutableTypeConversionDict[str, str]: ...
69     headers: EnvironHeaders
70     path: Text
71     full_path: Text
72     script_root: Text
73     url: Text
74     base_url: Text
75     url_root: Text
76     host_url: Text
77     host: Text
78     query_string: bytes
79     method: Text
80     @property
81     def access_route(self) -> Sequence[str]: ...
82     @property
83     def remote_addr(self) -> str: ...
84     remote_user: Text
85     scheme: str
86     is_xhr: bool
87     is_secure: bool
88     is_multithread: bool
89     is_multiprocess: bool
90     is_run_once: bool
91
92 _OnCloseT = TypeVar("_OnCloseT", bound=Callable[[], Any])
93 _SelfT = TypeVar("_SelfT", bound=BaseResponse)
94
95 class BaseResponse:
96     charset: str
97     default_status: int
98     default_mimetype: str | None
99     implicit_sequence_conversion: bool
100     autocorrect_location_header: bool
101     automatically_set_content_length: bool
102     headers: Headers
103     status_code: int
104     status: str
105     direct_passthrough: bool
106     response: Iterable[bytes]
107     def __init__(
108         self,
109         response: str | bytes | bytearray | Iterable[str] | Iterable[bytes] | None = ...,
110         status: Text | int | None = ...,
111         headers: Headers | Mapping[Text, Text] | Sequence[tuple[Text, Text]] | None = ...,
112         mimetype: Text | None = ...,
113         content_type: Text | None = ...,
114         direct_passthrough: bool = ...,
115     ) -> None: ...
116     def call_on_close(self, func: _OnCloseT) -> _OnCloseT: ...
117     @classmethod
118     def force_type(cls: Type[_SelfT], response: object, environ: WSGIEnvironment | None = ...) -> _SelfT: ...
119     @classmethod
120     def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ...
121     @overload
122     def get_data(self, as_text: Literal[False] = ...) -> bytes: ...
123     @overload
124     def get_data(self, as_text: Literal[True]) -> Text: ...
125     @overload
126     def get_data(self, as_text: bool) -> Any: ...
127     def set_data(self, value: bytes | Text) -> None: ...
128     data: Any
129     def calculate_content_length(self) -> int | None: ...
130     def make_sequence(self) -> None: ...
131     def iter_encoded(self) -> Iterator[bytes]: ...
132     def set_cookie(
133         self,
134         key: str,
135         value: str | bytes = ...,
136         max_age: float | timedelta | None = ...,
137         expires: int | datetime | None = ...,
138         path: str = ...,
139         domain: str | None = ...,
140         secure: bool = ...,
141         httponly: bool = ...,
142         samesite: str | None = ...,
143     ) -> None: ...
144     def delete_cookie(self, key, path: str = ..., domain: Any | None = ...): ...
145     @property
146     def is_streamed(self) -> bool: ...
147     @property
148     def is_sequence(self) -> bool: ...
149     def close(self) -> None: ...
150     def __enter__(self): ...
151     def __exit__(self, exc_type, exc_value, tb): ...
152     # The no_etag argument if fictional, but required for compatibility with
153     # ETagResponseMixin
154     def freeze(self, no_etag: bool = ...) -> None: ...
155     def get_wsgi_headers(self, environ): ...
156     def get_app_iter(self, environ): ...
157     def get_wsgi_response(self, environ): ...
158     def __call__(self, environ, start_response): ...
159
160 class AcceptMixin(object):
161     @property
162     def accept_mimetypes(self) -> MIMEAccept: ...
163     @property
164     def accept_charsets(self) -> CharsetAccept: ...
165     @property
166     def accept_encodings(self) -> Accept: ...
167     @property
168     def accept_languages(self) -> LanguageAccept: ...
169
170 class ETagRequestMixin:
171     @property
172     def cache_control(self): ...
173     @property
174     def if_match(self): ...
175     @property
176     def if_none_match(self): ...
177     @property
178     def if_modified_since(self): ...
179     @property
180     def if_unmodified_since(self): ...
181     @property
182     def if_range(self): ...
183     @property
184     def range(self): ...
185
186 class UserAgentMixin:
187     @property
188     def user_agent(self) -> UserAgent: ...
189
190 class AuthorizationMixin:
191     @property
192     def authorization(self) -> Authorization | None: ...
193
194 class StreamOnlyMixin:
195     disable_data_descriptor: Any
196     want_form_data_parsed: Any
197
198 class ETagResponseMixin:
199     @property
200     def cache_control(self): ...
201     status_code: Any
202     def make_conditional(self, request_or_environ, accept_ranges: bool = ..., complete_length: Any | None = ...): ...
203     def add_etag(self, overwrite: bool = ..., weak: bool = ...): ...
204     def set_etag(self, etag, weak: bool = ...): ...
205     def get_etag(self): ...
206     def freeze(self, no_etag: bool = ...) -> None: ...
207     accept_ranges: Any
208     content_range: Any
209
210 class ResponseStream:
211     mode: Any
212     response: Any
213     closed: Any
214     def __init__(self, response): ...
215     def write(self, value): ...
216     def writelines(self, seq): ...
217     def close(self): ...
218     def flush(self): ...
219     def isatty(self): ...
220     @property
221     def encoding(self): ...
222
223 class ResponseStreamMixin:
224     @property
225     def stream(self) -> ResponseStream: ...
226
227 class CommonRequestDescriptorsMixin:
228     @property
229     def content_type(self) -> str | None: ...
230     @property
231     def content_length(self) -> int | None: ...
232     @property
233     def content_encoding(self) -> str | None: ...
234     @property
235     def content_md5(self) -> str | None: ...
236     @property
237     def referrer(self) -> str | None: ...
238     @property
239     def date(self) -> datetime | None: ...
240     @property
241     def max_forwards(self) -> int | None: ...
242     @property
243     def mimetype(self) -> str: ...
244     @property
245     def mimetype_params(self) -> Mapping[str, str]: ...
246     @property
247     def pragma(self) -> HeaderSet: ...
248
249 class CommonResponseDescriptorsMixin:
250     mimetype: str | None = ...
251     @property
252     def mimetype_params(self) -> MutableMapping[str, str]: ...
253     location: str | None = ...
254     age: Any = ...  # get: datetime.timedelta | None
255     content_type: str | None = ...
256     content_length: int | None = ...
257     content_location: str | None = ...
258     content_encoding: str | None = ...
259     content_md5: str | None = ...
260     date: Any = ...  # get: datetime.datetime | None
261     expires: Any = ...  # get: datetime.datetime | None
262     last_modified: Any = ...  # get: datetime.datetime | None
263     retry_after: Any = ...  # get: datetime.datetime | None
264     vary: str | None = ...
265     content_language: str | None = ...
266     allow: str | None = ...
267
268 class WWWAuthenticateMixin:
269     @property
270     def www_authenticate(self): ...
271
272 class Request(BaseRequest, AcceptMixin, ETagRequestMixin, UserAgentMixin, AuthorizationMixin, CommonRequestDescriptorsMixin): ...
273 class PlainRequest(StreamOnlyMixin, Request): ...
274 class Response(BaseResponse, ETagResponseMixin, ResponseStreamMixin, CommonResponseDescriptorsMixin, WWWAuthenticateMixin): ...