mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
Update typing.MutableMapping.update stubs to allow keyword-only arguments (#1370)
This commit is contained in:
committed by
Jelle Zijlstra
parent
40c6927cf0
commit
5db571a8f3
@@ -635,9 +635,11 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def popitem(self) -> Tuple[_KT, _VT]: ...
|
||||
def setdefault(self, k: _KT, default: _VT = None) -> _VT: ...
|
||||
@overload
|
||||
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, **kwargs: _VT) -> None: ...
|
||||
def keys(self) -> KeysView[_KT]: ...
|
||||
def values(self) -> ValuesView[_VT]: ...
|
||||
def items(self) -> ItemsView[_KT, _VT]: ...
|
||||
|
||||
@@ -138,9 +138,11 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
# Dict.update. Not sure if we should use '# type: ignore' instead
|
||||
# and omit the type from the union.
|
||||
@overload
|
||||
def update(self, m: Mapping[_T, int], **kwargs: int) -> None: ...
|
||||
def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ...
|
||||
@overload
|
||||
def update(self, m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
|
||||
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
|
||||
@overload
|
||||
def update(self, **kwargs: int) -> None: ...
|
||||
|
||||
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
|
||||
@@ -327,9 +327,11 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
# known to be a Mapping with unknown type parameters, which is closer
|
||||
# to the behavior we want. See mypy issue #1430.
|
||||
@overload
|
||||
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, **kwargs: _VT) -> None: ...
|
||||
|
||||
Text = str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user