Skip to content

Commit 34a5fcf

Browse files
hukkinj11st1
authored andcommitted
Improve type annotations of Map.update and MapMutation.update
1 parent 9815896 commit 34a5fcf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

immutables/_map.pyi

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from typing import Literal
77
from typing import Mapping
88
from typing import MutableMapping
99
from typing import NoReturn
10+
from typing import overload
1011
from typing import Tuple
1112
from typing import Type
1213
from typing import TypeVar
@@ -46,8 +47,11 @@ class Map(Mapping[K, V]):
4647
def __reduce__(self) -> Tuple[Type[Map], Tuple[dict]]: ...
4748
def __len__(self) -> int: ...
4849
def __eq__(self, other: Any) -> bool: ...
50+
@overload
51+
def update(self, **kw: V) -> Map[str, V]: ...
52+
@overload
4953
def update(
50-
self, col: Union[Mapping[K, V], Iterable[Tuple[K, V]]] = ..., **kw: V
54+
self, col: Union[Mapping[K, V], Iterable[Tuple[K, V]]], **kw: V
5155
) -> Map[K, V]: ...
5256
def mutate(self) -> MapMutation[K, V]: ...
5357
def set(self, key: K, val: V) -> Map[K, V]: ...
@@ -79,9 +83,12 @@ class MapMutation(MutableMapping[K, V]):
7983
def get(self, key: K, default: D = ...) -> Union[V, D]: ...
8084
def __getitem__(self, key: K) -> V: ...
8185
def __contains__(self, key: Any) -> bool: ...
86+
@overload
87+
def update(self, **kw: V) -> None: ...
88+
@overload
8289
def update(
83-
self, col: Union[Mapping[K, V], Iterable[Tuple[K, V]]] = ..., **kw: V
84-
): ...
90+
self, col: Union[Mapping[K, V], Iterable[Tuple[K, V]]], **kw: V
91+
) -> None: ...
8592
def finish(self) -> Map[K, V]: ...
8693
def __len__(self) -> int: ...
8794
def __eq__(self, other: Any) -> bool: ...

0 commit comments

Comments
 (0)