massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / cgi.pyi
1 import sys
2 from _typeshed import SupportsGetItem, SupportsItemAccess
3 from builtins import type as _type
4 from collections.abc import Iterable, Iterator, Mapping
5 from typing import IO, Any, Protocol, TypeVar
6
7 _T = TypeVar("_T", bound=FieldStorage)
8
9 def parse(
10     fp: IO[Any] | None = ...,
11     environ: SupportsItemAccess[str, str] = ...,
12     keep_blank_values: bool = ...,
13     strict_parsing: bool = ...,
14     separator: str = ...,
15 ) -> dict[str, list[str]]: ...
16
17 if sys.version_info < (3, 8):
18     def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, list[str]]: ...
19     def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ...
20
21 if sys.version_info >= (3, 7):
22     def parse_multipart(
23         fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ..., separator: str = ...
24     ) -> dict[str, list[Any]]: ...
25
26 else:
27     def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, list[bytes]]: ...
28
29 class _Environ(Protocol):
30     def __getitem__(self, __k: str) -> str: ...
31     def keys(self) -> Iterable[str]: ...
32
33 def parse_header(line: str) -> tuple[str, dict[str, str]]: ...
34 def test(environ: _Environ = ...) -> None: ...
35 def print_environ(environ: _Environ = ...) -> None: ...
36 def print_form(form: dict[str, Any]) -> None: ...
37 def print_directory() -> None: ...
38 def print_environ_usage() -> None: ...
39
40 if sys.version_info < (3, 8):
41     def escape(s: str, quote: bool | None = ...) -> str: ...
42
43 class MiniFieldStorage:
44     # The first five "Any" attributes here are always None, but mypy doesn't support that
45     filename: Any
46     list: Any
47     type: Any
48     file: IO[bytes] | None
49     type_options: dict[Any, Any]
50     disposition: Any
51     disposition_options: dict[Any, Any]
52     headers: dict[Any, Any]
53     name: Any
54     value: Any
55     def __init__(self, name: Any, value: Any) -> None: ...
56     def __repr__(self) -> str: ...
57
58 _list = list
59
60 class FieldStorage(object):
61     FieldStorageClass: _type | None
62     keep_blank_values: int
63     strict_parsing: int
64     qs_on_post: str | None
65     headers: Mapping[str, str]
66     fp: IO[bytes]
67     encoding: str
68     errors: str
69     outerboundary: bytes
70     bytes_read: int
71     limit: int | None
72     disposition: str
73     disposition_options: dict[str, str]
74     filename: str | None
75     file: IO[bytes] | None
76     type: str
77     type_options: dict[str, str]
78     innerboundary: bytes
79     length: int
80     done: int
81     list: _list[Any] | None
82     value: None | bytes | _list[Any]
83     def __init__(
84         self,
85         fp: IO[Any] | None = ...,
86         headers: Mapping[str, str] | None = ...,
87         outerboundary: bytes = ...,
88         environ: SupportsGetItem[str, str] = ...,
89         keep_blank_values: int = ...,
90         strict_parsing: int = ...,
91         limit: int | None = ...,
92         encoding: str = ...,
93         errors: str = ...,
94         max_num_fields: int | None = ...,
95         separator: str = ...,
96     ) -> None: ...
97     def __enter__(self: _T) -> _T: ...
98     def __exit__(self, *args: Any) -> None: ...
99     def __repr__(self) -> str: ...
100     def __iter__(self) -> Iterator[str]: ...
101     def __getitem__(self, key: str) -> Any: ...
102     def getvalue(self, key: str, default: Any = ...) -> Any: ...
103     def getfirst(self, key: str, default: Any = ...) -> Any: ...
104     def getlist(self, key: str) -> _list[Any]: ...
105     def keys(self) -> _list[str]: ...
106     def __contains__(self, key: str) -> bool: ...
107     def __len__(self) -> int: ...
108     def __bool__(self) -> bool: ...
109     # In Python 3 it returns bytes or str IO depending on an internal flag
110     def make_file(self) -> IO[Any]: ...