2 from _typeshed import SupportsWrite
3 from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
4 from typing import Any, Iterable, Iterator, Mapping, Protocol, Tuple
6 from ..datastructures import Headers
8 class WSGIWarning(Warning): ...
9 class HTTPWarning(Warning): ...
11 def check_string(context: str, obj: object, stacklevel: int = ...) -> None: ...
13 class _SupportsReadEtc(Protocol):
14 def read(self, __size: int = ...) -> bytes: ...
15 def readline(self, __size: int = ...) -> bytes: ...
16 def __iter__(self) -> Iterator[bytes]: ...
17 def close(self) -> Any: ...
19 class InputStream(object):
20 def __init__(self, stream: _SupportsReadEtc) -> None: ...
21 def read(self, __size: int = ...) -> bytes: ...
22 def readline(self, __size: int = ...) -> bytes: ...
23 def __iter__(self) -> Iterator[bytes]: ...
24 def close(self) -> None: ...
26 class _SupportsWriteEtc(Protocol):
27 def write(self, __s: str) -> Any: ...
28 def flush(self) -> Any: ...
29 def close(self) -> Any: ...
31 class ErrorStream(object):
32 def __init__(self, stream: _SupportsWriteEtc) -> None: ...
33 def write(self, s: str) -> None: ...
34 def flush(self) -> None: ...
35 def writelines(self, seq: Iterable[str]) -> None: ...
36 def close(self) -> None: ...
38 class GuardedWrite(object):
39 def __init__(self, write: SupportsWrite[str], chunks: list[int]) -> None: ...
40 def __call__(self, s: str) -> None: ...
42 class GuardedIterator(object):
46 def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: list[int]) -> None: ...
47 def __iter__(self) -> GuardedIterator: ...
48 if sys.version_info >= (3, 0):
49 def __next__(self) -> str: ...
51 def next(self) -> str: ...
52 def close(self) -> None: ...
54 class LintMiddleware(object):
55 def __init__(self, app: WSGIApplication) -> None: ...
56 def check_environ(self, environ: WSGIEnvironment) -> None: ...
57 def check_start_response(
58 self, status: str, headers: list[tuple[str, str]], exc_info: Tuple[Any, ...] | None
59 ) -> tuple[int, Headers]: ...
60 def check_headers(self, headers: Mapping[str, str]) -> None: ...
61 def check_iterator(self, app_iter: Iterable[bytes]) -> None: ...
62 def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> GuardedIterator: ...