massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / wsgiref / types.pyi
1 # Type declaration for a WSGI Function\r
2 #\r
3 # wsgiref/types.py doesn't exist and neither do the types defined in this\r
4 # file. They are provided for type checking purposes.\r
5 #\r
6 # This means you cannot simply import wsgiref.types in your code. Instead,\r
7 # use the `TYPE_CHECKING` flag from the typing module:\r
8 #\r
9 #   from typing import TYPE_CHECKING\r
10 #\r
11 #   if TYPE_CHECKING:\r
12 #       from wsgiref.types import WSGIApplication\r
13 #\r
14 # This import is now only taken into account by the type checker. Consequently,\r
15 # you need to use 'WSGIApplication' and not simply WSGIApplication when type\r
16 # hinting your code.  Otherwise Python will raise NameErrors.\r
17 \r
18 from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union, Any, Text, Protocol\r
19 from types import TracebackType\r
20 \r
21 _exc_info = Tuple[Optional[Type[BaseException]],\r
22                   Optional[BaseException],\r
23                   Optional[TracebackType]]\r
24 StartResponse = Union[\r
25     Callable[[Text, List[Tuple[Text, Text]]], Callable[[bytes], None]],\r
26     Callable[[Text, List[Tuple[Text, Text]], _exc_info], Callable[[bytes], None]]\r
27 ]\r
28 WSGIEnvironment = Dict[Text, Any]\r
29 WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]\r
30 \r
31 # WSGI input streams per PEP 3333\r
32 class InputStream(Protocol):\r
33     def read(self, size: int = ...) -> bytes: ...\r
34     def readline(self, size: int = ...) -> bytes: ...\r
35     def readlines(self, hint: int = ...) -> List[bytes]: ...\r
36     def __iter__(self) -> Iterable[bytes]: ...\r
37 \r
38 # WSGI error streams per PEP 3333\r
39 class ErrorStream(Protocol):\r
40     def flush(self) -> None: ...\r
41     def write(self, s: str) -> None: ...\r
42     def writelines(self, seq: List[str]) -> None: ...\r