Use built-in generic (#5050)

This commit is contained in:
Sebastian Rittau
2021-02-23 10:04:51 +01:00
committed by GitHub
parent ffcd592aef
commit c8df617726
2 changed files with 23 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
import sys
from _typeshed import SupportsGetItem, SupportsItemAccess
from builtins import type as _type
from typing import IO, Any, AnyStr, Dict, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple, TypeVar, Union
from typing import IO, Any, AnyStr, Iterable, Iterator, Mapping, Optional, Protocol, TypeVar, Union
_T = TypeVar("_T", bound=FieldStorage)
@@ -10,28 +10,28 @@ def parse(
environ: SupportsItemAccess[str, str] = ...,
keep_blank_values: bool = ...,
strict_parsing: bool = ...,
) -> Dict[str, List[str]]: ...
) -> 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]]: ...
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> List[Tuple[str, str]]: ...
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, list[str]]: ...
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ...
if sys.version_info >= (3, 7):
def parse_multipart(
fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ...
) -> Dict[str, List[Any]]: ...
) -> dict[str, list[Any]]: ...
else:
def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> Dict[str, List[bytes]]: ...
def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, list[bytes]]: ...
class _Environ(Protocol):
def __getitem__(self, __k: str) -> str: ...
def keys(self) -> Iterable[str]: ...
def parse_header(line: str) -> Tuple[str, Dict[str, str]]: ...
def parse_header(line: str) -> tuple[str, dict[str, str]]: ...
def test(environ: _Environ = ...) -> None: ...
def print_environ(environ: _Environ = ...) -> None: ...
def print_form(form: Dict[str, Any]) -> None: ...
def print_form(form: dict[str, Any]) -> None: ...
def print_directory() -> None: ...
def print_environ_usage() -> None: ...
@@ -47,15 +47,17 @@ class MiniFieldStorage:
list: Any
type: Any
file: Optional[IO[bytes]]
type_options: Dict[Any, Any]
type_options: dict[Any, Any]
disposition: Any
disposition_options: Dict[Any, Any]
headers: Dict[Any, Any]
disposition_options: dict[Any, Any]
headers: dict[Any, Any]
name: Any
value: Any
def __init__(self, name: Any, value: Any) -> None: ...
def __repr__(self) -> str: ...
_list = list
class FieldStorage(object):
FieldStorageClass: Optional[_type]
keep_blank_values: int
@@ -69,16 +71,16 @@ class FieldStorage(object):
bytes_read: int
limit: Optional[int]
disposition: str
disposition_options: Dict[str, str]
disposition_options: dict[str, str]
filename: Optional[str]
file: Optional[IO[bytes]]
type: str
type_options: Dict[str, str]
type_options: dict[str, str]
innerboundary: bytes
length: int
done: int
list: Optional[List[Any]]
value: Union[None, bytes, List[Any]]
list: Optional[_list[Any]]
value: Union[None, bytes, _list[Any]]
if sys.version_info >= (3, 6):
def __init__(
@@ -125,8 +127,8 @@ class FieldStorage(object):
def __getitem__(self, key: str) -> Any: ...
def getvalue(self, key: str, default: Any = ...) -> Any: ...
def getfirst(self, key: str, default: Any = ...) -> Any: ...
def getlist(self, key: str) -> List[Any]: ...
def keys(self) -> List[str]: ...
def getlist(self, key: str) -> _list[Any]: ...
def keys(self) -> _list[str]: ...
if sys.version_info < (3, 0):
def has_key(self, key: str) -> bool: ...
def __contains__(self, key: str) -> bool: ...
@@ -144,7 +146,7 @@ class FieldStorage(object):
if sys.version_info < (3, 0):
from UserDict import UserDict
class FormContentDict(UserDict[str, List[str]]):
class FormContentDict(UserDict[str, list[str]]):
query_string: str
def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
class SvFormContentDict(FormContentDict):
@@ -159,4 +161,4 @@ if sys.version_info < (3, 0):
def value(self, key: Any) -> Any: ...
def length(self, key: Any) -> int: ...
def stripped(self, key: Any) -> Any: ...
def pars(self) -> Dict[Any, Any]: ...
def pars(self) -> dict[Any, Any]: ...