Debian Codegraph @

jedi/third_party/typeshed/stdlib/cgi.pyi

raw symbols SCIP
1 import os
2 from _typeshed import SupportsContainsAndGetItem, SupportsGetItem, SupportsItemAccess, Unused
3 from builtins import list as _list, type as _type
4 from collections.abc import Iterable, Iterator, Mapping
5 from email.message import Message
6 from types import TracebackType
7 from typing import IO, Any, Protocol, type_check_only
8 from typing_extensions import Self
9
10 __all__ = [
11 "MiniFieldStorage",
12 "FieldStorage",
13 "parse",
14 "parse_multipart",
15 "parse_header",
16 "test",
17 "print_exception",
18 "print_environ",
19 "print_form",
20 "print_directory",
21 "print_arguments",
22 "print_environ_usage",
23 ]
24
25 def parse(
26 fp: IO[Any] | None = None,
27 environ: SupportsItemAccess[str, str] = os.environ,
28 keep_blank_values: bool = ...,
29 strict_parsing: bool = ...,
30 separator: str = "&",
31 ) -> dict[str, list[str]]: ...
32 def parse_multipart(
33 fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&"
34 ) -> dict[str, list[Any]]: ...
35 @type_check_only
36 class _Environ(Protocol):
37 def __getitem__(self, k: str, /) -> str: ...
38 def keys(self) -> Iterable[str]: ...
39
40 def parse_header(line: str) -> tuple[str, dict[str, str]]: ...
41 def test(environ: _Environ = os.environ) -> None: ...
42 def print_environ(environ: _Environ = os.environ) -> None: ...
43 def print_form(form: dict[str, Any]) -> None: ...
44 def print_directory() -> None: ...
45 def print_environ_usage() -> None: ...
46
47 class MiniFieldStorage:
48 # The first five "Any" attributes here are always None, but mypy doesn't support that
49 filename: Any
50 list: Any
51 type: Any
52 file: IO[bytes] | None
53 type_options: dict[Any, Any]
54 disposition: Any
55 disposition_options: dict[Any, Any]
56 headers: dict[Any, Any]
57 name: Any
58 value: Any
59 def __init__(self, name: Any, value: Any) -> None: ...
60
61 class FieldStorage:
62 FieldStorageClass: _type | None
63 keep_blank_values: int
64 strict_parsing: int
65 qs_on_post: str | None
66 headers: Mapping[str, str] | Message
67 fp: IO[bytes]
68 encoding: str
69 errors: str
70 outerboundary: bytes
71 bytes_read: int
72 limit: int | None
73 disposition: str
74 disposition_options: dict[str, str]
75 filename: str | None
76 file: IO[bytes] | None
77 type: str
78 type_options: dict[str, str]
79 innerboundary: bytes
80 length: int
81 done: int
82 list: _list[Any] | None
83 value: None | bytes | _list[Any]
84 def __init__(
85 self,
86 fp: IO[Any] | None = None,
87 headers: Mapping[str, str] | Message | None = None,
88 outerboundary: bytes = b"",
89 environ: SupportsContainsAndGetItem[str, str] = os.environ,
90 keep_blank_values: int = 0,
91 strict_parsing: int = 0,
92 limit: int | None = None,
93 encoding: str = "utf-8",
94 errors: str = "replace",
95 max_num_fields: int | None = None,
96 separator: str = "&",
97 ) -> None: ...
98 def __enter__(self) -> Self: ...
99 def __exit__(self, *args: Unused) -> None: ...
100 def __iter__(self) -> Iterator[str]: ...
101 def __getitem__(self, key: str) -> Any: ...
102 def getvalue(self, key: str, default: Any = None) -> Any: ...
103 def getfirst(self, key: str, default: Any = None) -> 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 def __del__(self) -> None: ...
110 # Returns bytes or str IO depending on an internal flag
111 def make_file(self) -> IO[Any]: ...
112
113 def print_exception(
114 type: type[BaseException] | None = None,
115 value: BaseException | None = None,
116 tb: TracebackType | None = None,
117 limit: int | None = None,
118 ) -> None: ...
119 def print_arguments() -> None: ...