mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-07 14:00:12 +08:00
cgi: various improvements (#3790)
- add max_num_fields to FieldStorage - fix various types based on default values
This commit is contained in:
+10
-6
@@ -3,7 +3,7 @@ from typing import Any, AnyStr, Dict, IO, Iterable, List, Mapping, Optional, Tup
|
||||
|
||||
_T = TypeVar('_T', bound=FieldStorage)
|
||||
|
||||
def parse(fp: IO[Any] = ..., environ: Mapping[str, str] = ...,
|
||||
def parse(fp: Optional[IO[Any]] = ..., environ: Mapping[str, str] = ...,
|
||||
keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
if sys.version_info < (3, 8):
|
||||
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
@@ -12,7 +12,7 @@ if sys.version_info >= (3, 7):
|
||||
def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes], encoding: str = ..., errors: str = ...) -> Dict[str, List[Any]]: ...
|
||||
else:
|
||||
def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes]) -> Dict[str, List[bytes]]: ...
|
||||
def parse_header(s: str) -> Tuple[str, Dict[str, str]]: ...
|
||||
def parse_header(line: str) -> Tuple[str, Dict[str, str]]: ...
|
||||
def test(environ: Mapping[str, str] = ...) -> None: ...
|
||||
def print_environ(environ: Mapping[str, str] = ...) -> None: ...
|
||||
def print_form(form: Dict[str, Any]) -> None: ...
|
||||
@@ -21,7 +21,7 @@ def print_environ_usage() -> None: ...
|
||||
if sys.version_info < (3,):
|
||||
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
|
||||
elif sys.version_info < (3, 8):
|
||||
def escape(s: str, quote: bool = ...) -> str: ...
|
||||
def escape(s: str, quote: Optional[bool] = ...) -> str: ...
|
||||
|
||||
class MiniFieldStorage:
|
||||
# The first five "Any" attributes here are always None, but mypy doesn't support that
|
||||
@@ -64,10 +64,14 @@ class FieldStorage(object):
|
||||
list: Optional[List[Any]]
|
||||
value: Union[None, bytes, List[Any]]
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ...,
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init__(self, fp: Optional[IO[Any]] = ..., headers: Optional[Mapping[str, str]] = ..., outerboundary: bytes = ...,
|
||||
environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...,
|
||||
limit: int = ..., encoding: str = ..., errors: str = ...) -> None: ...
|
||||
limit: Optional[int] = ..., encoding: str = ..., errors: str = ..., max_num_fields: Optional[int] = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 0):
|
||||
def __init__(self, fp: Optional[IO[Any]] = ..., headers: Optional[Mapping[str, str]] = ..., outerboundary: bytes = ...,
|
||||
environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...,
|
||||
limit: Optional[int] = ..., encoding: str = ..., errors: str = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ...,
|
||||
environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
|
||||
|
||||
@@ -17,7 +17,6 @@ asyncio.runners
|
||||
asyncio.tasks.Task.__init__
|
||||
bdb.GENERATOR_AND_COROUTINE_FLAGS
|
||||
builtins.str.maketrans
|
||||
cgi.escape
|
||||
cmath.log
|
||||
codecs.StreamRecoder.seek
|
||||
collections.Reversible
|
||||
|
||||
@@ -9,7 +9,6 @@ asyncio.protocols.BufferedProtocol
|
||||
asyncio.runners
|
||||
asyncio.tasks.Task._wakeup
|
||||
builtins.str.maketrans
|
||||
cgi.escape
|
||||
cmath.log
|
||||
codecs.StreamRecoder.seek
|
||||
collections.AsyncGenerator.ag_await
|
||||
|
||||
@@ -22,7 +22,6 @@ asyncio.selector_events.BaseSelectorEventLoop.create_unix_server
|
||||
builtins.dict.get
|
||||
builtins.reversed
|
||||
builtins.str.maketrans
|
||||
cgi.escape
|
||||
cmath.log
|
||||
collections.AsyncGenerator.ag_await
|
||||
collections.AsyncGenerator.ag_code
|
||||
|
||||
@@ -125,9 +125,6 @@ bz2.BZ2File.readinto
|
||||
bz2.BZ2File.readlines
|
||||
bz2.BZ2File.write
|
||||
bz2.BZ2File.writelines
|
||||
cgi.FieldStorage.__init__
|
||||
cgi.parse
|
||||
cgi.parse_header
|
||||
codecs.BufferedIncrementalDecoder.decode
|
||||
codecs.CodecInfo.decode
|
||||
codecs.CodecInfo.encode
|
||||
|
||||
Reference in New Issue
Block a user