massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / _typeshed / wsgi.pyi
1 # Types to support PEP 3333 (WSGI)
2 #
3 # See the README.md file in this directory for more information.
4
5 from sys import _OptExcInfo
6 from typing import Any, Callable, Dict, Iterable, Protocol
7
8 # stable
9 class StartResponse(Protocol):
10     def __call__(
11         self, status: str, headers: list[tuple[str, str]], exc_info: _OptExcInfo | None = ...
12     ) -> Callable[[bytes], Any]: ...
13
14 WSGIEnvironment = Dict[str, Any]  # stable
15 WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]  # stable
16
17 # WSGI input streams per PEP 3333, stable
18 class InputStream(Protocol):
19     def read(self, size: int = ...) -> bytes: ...
20     def readline(self, size: int = ...) -> bytes: ...
21     def readlines(self, hint: int = ...) -> list[bytes]: ...
22     def __iter__(self) -> Iterable[bytes]: ...
23
24 # WSGI error streams per PEP 3333, stable
25 class ErrorStream(Protocol):
26     def flush(self) -> None: ...
27     def write(self, s: str) -> None: ...
28     def writelines(self, seq: list[str]) -> None: ...
29
30 class _Readable(Protocol):
31     def read(self, size: int = ...) -> bytes: ...
32
33 # Optional file wrapper in wsgi.file_wrapper
34 class FileWrapper(Protocol):
35     def __call__(self, file: _Readable, block_size: int = ...) -> Iterable[bytes]: ...