massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / wsgiref / handlers.pyi
1 from abc import abstractmethod
2 from types import TracebackType
3 from typing import IO, Callable, MutableMapping, Optional, Tuple, Type
4
5 from .headers import Headers
6 from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment
7 from .util import FileWrapper
8
9 _exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
10
11 def format_date_time(timestamp: float | None) -> str: ...  # undocumented
12 def read_environ() -> dict[str, str]: ...
13
14 class BaseHandler:
15     wsgi_version: tuple[int, int]  # undocumented
16     wsgi_multithread: bool
17     wsgi_multiprocess: bool
18     wsgi_run_once: bool
19
20     origin_server: bool
21     http_version: str
22     server_software: str | None
23
24     os_environ: MutableMapping[str, str]
25
26     wsgi_file_wrapper: Type[FileWrapper] | None
27     headers_class: Type[Headers]  # undocumented
28
29     traceback_limit: int | None
30     error_status: str
31     error_headers: list[tuple[str, str]]
32     error_body: bytes
33     def run(self, application: WSGIApplication) -> None: ...
34     def setup_environ(self) -> None: ...
35     def finish_response(self) -> None: ...
36     def get_scheme(self) -> str: ...
37     def set_content_length(self) -> None: ...
38     def cleanup_headers(self) -> None: ...
39     def start_response(
40         self, status: str, headers: list[tuple[str, str]], exc_info: _exc_info | None = ...
41     ) -> Callable[[bytes], None]: ...
42     def send_preamble(self) -> None: ...
43     def write(self, data: bytes) -> None: ...
44     def sendfile(self) -> bool: ...
45     def finish_content(self) -> None: ...
46     def close(self) -> None: ...
47     def send_headers(self) -> None: ...
48     def result_is_file(self) -> bool: ...
49     def client_is_modern(self) -> bool: ...
50     def log_exception(self, exc_info: _exc_info) -> None: ...
51     def handle_error(self) -> None: ...
52     def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ...
53     @abstractmethod
54     def _write(self, data: bytes) -> None: ...
55     @abstractmethod
56     def _flush(self) -> None: ...
57     @abstractmethod
58     def get_stdin(self) -> InputStream: ...
59     @abstractmethod
60     def get_stderr(self) -> ErrorStream: ...
61     @abstractmethod
62     def add_cgi_vars(self) -> None: ...
63
64 class SimpleHandler(BaseHandler):
65     stdin: InputStream
66     stdout: IO[bytes]
67     stderr: ErrorStream
68     base_env: MutableMapping[str, str]
69     def __init__(
70         self,
71         stdin: InputStream,
72         stdout: IO[bytes],
73         stderr: ErrorStream,
74         environ: MutableMapping[str, str],
75         multithread: bool = ...,
76         multiprocess: bool = ...,
77     ) -> None: ...
78     def get_stdin(self) -> InputStream: ...
79     def get_stderr(self) -> ErrorStream: ...
80     def add_cgi_vars(self) -> None: ...
81     def _write(self, data: bytes) -> None: ...
82     def _flush(self) -> None: ...
83
84 class BaseCGIHandler(SimpleHandler): ...
85
86 class CGIHandler(BaseCGIHandler):
87     def __init__(self) -> None: ...
88
89 class IISCGIHandler(BaseCGIHandler):
90     def __init__(self) -> None: ...