mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 20:24:31 +08:00
Remove _Val alias for MultiValueDict so that generic evaluate (#36)
* remove _Val alias for MultiValueDict so that generic evaluate * fix multivaluedict init argument
This commit is contained in:
@@ -12,8 +12,11 @@ from typing import (
|
|||||||
Union,
|
Union,
|
||||||
overload,
|
overload,
|
||||||
Iterator,
|
Iterator,
|
||||||
|
Optional,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
_K = TypeVar("_K")
|
_K = TypeVar("_K")
|
||||||
_V = TypeVar("_V")
|
_V = TypeVar("_V")
|
||||||
|
|
||||||
@@ -27,24 +30,22 @@ class OrderedSet(MutableSet[_K]):
|
|||||||
|
|
||||||
class MultiValueDictKeyError(KeyError): ...
|
class MultiValueDictKeyError(KeyError): ...
|
||||||
|
|
||||||
_Val = Union[_V, List[_V]]
|
|
||||||
|
|
||||||
class MultiValueDict(MutableMapping[_K, _V]):
|
class MultiValueDict(MutableMapping[_K, _V]):
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, _Val]] = ...) -> None: ...
|
def __init__(self, key_to_list_mapping: Mapping[_K, Optional[List[_V]]] = ...) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, key_to_list_mapping: Mapping[_K, _Val] = ...) -> None: ...
|
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ...
|
||||||
def getlist(self, key: _K, default: List[_V] = None) -> List[_V]: ...
|
def getlist(self, key: _K, default: List[_V] = None) -> List[_V]: ...
|
||||||
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
||||||
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
||||||
def appendlist(self, key: _K, value: _V) -> None: ...
|
def appendlist(self, key: _K, value: _V) -> None: ...
|
||||||
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
||||||
def dict(self) -> Dict[_K, _Val]: ...
|
def dict(self) -> Dict[_K, Union[_V, List[_V]]]: ...
|
||||||
def copy(self) -> MultiValueDict[_K, _V]: ...
|
def copy(self) -> MultiValueDict[_K, _V]: ...
|
||||||
# These overrides are needed to convince mypy that this isn't an abstract class
|
# These overrides are needed to convince mypy that this isn't an abstract class
|
||||||
def __delitem__(self, item: _K) -> None: ...
|
def __delitem__(self, item: _K) -> None: ...
|
||||||
def __getitem__(self, item: _K) -> _Val: ... # type: ignore
|
def __getitem__(self, item: _K) -> Union[_V, Literal[[]]]: ... # type: ignore
|
||||||
def __setitem__(self, k: _K, v: _Val) -> None: ...
|
def __setitem__(self, k: _K, v: Union[_V, List[_V]]) -> None: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
def __iter__(self) -> Iterator[_K]: ...
|
def __iter__(self) -> Iterator[_K]: ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user