2 from typing import Any, AnyStr, Dict, IO, Iterable, List, Mapping, Optional, Tuple, TypeVar, Union
\r
4 _T = TypeVar('_T', bound=FieldStorage)
\r
6 def parse(fp: IO[Any] = ..., environ: Mapping[str, str] = ...,
\r
7 keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
\r
8 def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
\r
9 def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
\r
10 def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes]) -> Dict[str, List[bytes]]: ...
\r
11 def parse_header(s: str) -> Tuple[str, Dict[str, str]]: ...
\r
12 def test(environ: Mapping[str, str] = ...) -> None: ...
\r
13 def print_environ(environ: Mapping[str, str] = ...) -> None: ...
\r
14 def print_form(form: Dict[str, Any]) -> None: ...
\r
15 def print_directory() -> None: ...
\r
16 def print_environ_usage() -> None: ...
\r
17 if sys.version_info >= (3, 0):
\r
18 def escape(s: str, quote: bool = ...) -> str: ...
\r
20 def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
\r
23 class MiniFieldStorage:
\r
24 # The first five "Any" attributes here are always None, but mypy doesn't support that
\r
25 filename = ... # type: Any
\r
26 list = ... # type: Any
\r
27 type = ... # type: Any
\r
28 file = ... # type: Optional[IO[bytes]] # Always None
\r
29 type_options = ... # type: Dict[Any, Any]
\r
30 disposition = ... # type: Any
\r
31 disposition_options = ... # type: Dict[Any, Any]
\r
32 headers = ... # type: Dict[Any, Any]
\r
33 name = ... # type: Any
\r
34 value = ... # type: Any
\r
36 def __init__(self, name: Any, value: Any) -> None: ...
\r
37 def __repr__(self) -> str: ...
\r
40 class FieldStorage(object):
\r
41 FieldStorageClass = ... # type: Optional[type]
\r
42 keep_blank_values = ... # type: int
\r
43 strict_parsing = ... # type: int
\r
44 qs_on_post = ... # type: Optional[str]
\r
45 headers = ... # type: Mapping[str, str]
\r
46 fp = ... # type: IO[bytes]
\r
47 encoding = ... # type: str
\r
48 errors = ... # type: str
\r
49 outerboundary = ... # type: bytes
\r
50 bytes_read = ... # type: int
\r
51 limit = ... # type: Optional[int]
\r
52 disposition = ... # type: str
\r
53 disposition_options = ... # type: Dict[str, str]
\r
54 filename = ... # type: Optional[str]
\r
55 file = ... # type: Optional[IO[bytes]]
\r
56 type = ... # type: str
\r
57 type_options = ... # type: Dict[str, str]
\r
58 innerboundary = ... # type: bytes
\r
59 length = ... # type: int
\r
60 done = ... # type: int
\r
61 list = ... # type: Optional[List[Any]]
\r
62 value = ... # type: Union[None, bytes, List[Any]]
\r
64 if sys.version_info >= (3, 0):
\r
65 def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ...,
\r
66 environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...,
\r
67 limit: int = ..., encoding: str = ..., errors: str = ...) -> None: ...
\r
69 def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ...,
\r
70 environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
\r
72 if sys.version_info >= (3, 0):
\r
73 def __enter__(self: _T) -> _T: ...
\r
74 def __exit__(self, *args: Any) -> None: ...
\r
75 def __repr__(self) -> str: ...
\r
76 def __iter__(self) -> Iterable[str]: ...
\r
77 def __getitem__(self, key: str) -> Any: ...
\r
78 def getvalue(self, key: str, default: Any = ...) -> Any: ...
\r
79 def getfirst(self, key: str, default: Any = ...) -> Any: ...
\r
80 def getlist(self, key: str) -> List[Any]: ...
\r
81 def keys(self) -> List[str]: ...
\r
82 if sys.version_info < (3, 0):
\r
83 def has_key(self, key: str) -> bool: ...
\r
84 def __contains__(self, key: str) -> bool: ...
\r
85 def __len__(self) -> int: ...
\r
86 if sys.version_info >= (3, 0):
\r
87 def __bool__(self) -> bool: ...
\r
89 def __nonzero__(self) -> bool: ...
\r
90 if sys.version_info >= (3, 0):
\r
91 # In Python 3 it returns bytes or str IO depending on an internal flag
\r
92 def make_file(self) -> IO[Any]: ...
\r
94 # In Python 2 it always returns bytes and ignores the "binary" flag
\r
95 def make_file(self, binary: Any = ...) -> IO[bytes]: ...
\r
98 if sys.version_info < (3, 0):
\r
99 from UserDict import UserDict
\r
101 class FormContentDict(UserDict):
\r
102 query_string = ... # type: str
\r
103 def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
\r
105 class SvFormContentDict(FormContentDict):
\r
106 def getlist(self, key: Any) -> Any: ...
\r
108 class InterpFormContentDict(SvFormContentDict): ...
\r
110 class FormContent(FormContentDict):
\r
111 # TODO this should have
\r
112 # def values(self, key: Any) -> Any: ...
\r
113 # but this is incompatible with the supertype, and adding '# type: ignore' triggers
\r
114 # a parse error in pytype (https://github.com/google/pytype/issues/53)
\r
115 def indexed_value(self, key: Any, location: int) -> Any: ...
\r
116 def value(self, key: Any) -> Any: ...
\r
117 def length(self, key: Any) -> int: ...
\r
118 def stripped(self, key: Any) -> Any: ...
\r
119 def pars(self) -> Dict[Any, Any]: ...
\r