massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / Werkzeug / werkzeug / test.pyi
1 import sys
2 from _typeshed.wsgi import WSGIEnvironment
3 from typing import Any, Generic, Text, Type, TypeVar, overload
4 from typing_extensions import Literal
5
6 if sys.version_info >= (3, 0):
7     from http.cookiejar import CookieJar
8     from urllib.request import Request as U2Request
9 else:
10     from cookielib import CookieJar
11     from urllib2 import Request as U2Request
12
13 def stream_encode_multipart(values, use_tempfile: int = ..., threshold=..., boundary: Any | None = ..., charset: Text = ...): ...
14 def encode_multipart(values, boundary: Any | None = ..., charset: Text = ...): ...
15 def File(fd, filename: Any | None = ..., mimetype: Any | None = ...): ...
16
17 class _TestCookieHeaders:
18     headers: Any
19     def __init__(self, headers): ...
20     def getheaders(self, name): ...
21     def get_all(self, name, default: Any | None = ...): ...
22
23 class _TestCookieResponse:
24     headers: Any
25     def __init__(self, headers): ...
26     def info(self): ...
27
28 class _TestCookieJar(CookieJar):
29     def inject_wsgi(self, environ): ...
30     def extract_wsgi(self, environ, headers): ...
31
32 class EnvironBuilder:
33     server_protocol: Any
34     wsgi_version: Any
35     request_class: Any
36     charset: Text
37     path: Any
38     base_url: Any
39     query_string: Any
40     args: Any
41     method: Any
42     headers: Any
43     content_type: Any
44     errors_stream: Any
45     multithread: Any
46     multiprocess: Any
47     run_once: Any
48     environ_base: Any
49     environ_overrides: Any
50     input_stream: Any
51     content_length: Any
52     closed: Any
53     def __init__(
54         self,
55         path: str = ...,
56         base_url: Any | None = ...,
57         query_string: Any | None = ...,
58         method: str = ...,
59         input_stream: Any | None = ...,
60         content_type: Any | None = ...,
61         content_length: Any | None = ...,
62         errors_stream: Any | None = ...,
63         multithread: bool = ...,
64         multiprocess: bool = ...,
65         run_once: bool = ...,
66         headers: Any | None = ...,
67         data: Any | None = ...,
68         environ_base: Any | None = ...,
69         environ_overrides: Any | None = ...,
70         charset: Text = ...,
71     ): ...
72     form: Any
73     files: Any
74     @property
75     def server_name(self) -> str: ...
76     @property
77     def server_port(self) -> int: ...
78     def __del__(self) -> None: ...
79     def close(self) -> None: ...
80     def get_environ(self) -> WSGIEnvironment: ...
81     def get_request(self, cls: Any | None = ...): ...
82
83 class ClientRedirectError(Exception): ...
84
85 # Response type for the client below.
86 # By default _R is Tuple[Iterable[Any], Text | int, datastructures.Headers]
87 _R = TypeVar("_R")
88
89 class Client(Generic[_R]):
90     application: Any
91     response_wrapper: Type[_R] | None
92     cookie_jar: Any
93     allow_subdomain_redirects: Any
94     def __init__(
95         self, application, response_wrapper: Type[_R] | None = ..., use_cookies: bool = ..., allow_subdomain_redirects: bool = ...
96     ): ...
97     def set_cookie(
98         self,
99         server_name,
100         key,
101         value: str = ...,
102         max_age: Any | None = ...,
103         expires: Any | None = ...,
104         path: str = ...,
105         domain: Any | None = ...,
106         secure: Any | None = ...,
107         httponly: bool = ...,
108         charset: Text = ...,
109     ): ...
110     def delete_cookie(self, server_name, key, path: str = ..., domain: Any | None = ...): ...
111     def run_wsgi_app(self, environ, buffered: bool = ...): ...
112     def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ...
113     @overload
114     def open(self, *args, as_tuple: Literal[True], **kwargs) -> tuple[WSGIEnvironment, _R]: ...
115     @overload
116     def open(self, *args, as_tuple: Literal[False] = ..., **kwargs) -> _R: ...
117     @overload
118     def open(self, *args, as_tuple: bool, **kwargs) -> Any: ...
119     @overload
120     def get(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
121     @overload
122     def get(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
123     @overload
124     def get(self, *args, as_tuple: bool, **kw) -> Any: ...
125     @overload
126     def patch(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
127     @overload
128     def patch(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
129     @overload
130     def patch(self, *args, as_tuple: bool, **kw) -> Any: ...
131     @overload
132     def post(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
133     @overload
134     def post(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
135     @overload
136     def post(self, *args, as_tuple: bool, **kw) -> Any: ...
137     @overload
138     def head(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
139     @overload
140     def head(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
141     @overload
142     def head(self, *args, as_tuple: bool, **kw) -> Any: ...
143     @overload
144     def put(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
145     @overload
146     def put(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
147     @overload
148     def put(self, *args, as_tuple: bool, **kw) -> Any: ...
149     @overload
150     def delete(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
151     @overload
152     def delete(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
153     @overload
154     def delete(self, *args, as_tuple: bool, **kw) -> Any: ...
155     @overload
156     def options(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
157     @overload
158     def options(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
159     @overload
160     def options(self, *args, as_tuple: bool, **kw) -> Any: ...
161     @overload
162     def trace(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
163     @overload
164     def trace(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
165     @overload
166     def trace(self, *args, as_tuple: bool, **kw) -> Any: ...
167
168 def create_environ(*args, **kwargs): ...
169 def run_wsgi_app(app, environ, buffered: bool = ...): ...