Open
Description
The current overloads for MutableMapping.update() allow the use of keyword arguments even if the key type isn't str. I think it's possible to put a type hint on self so that keyword arguments only pass type checking when the key type is str, like this.
# **kwargs aren't allowed for general _KT
@overload
def update(self, m: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
@overload
def update(self, m: Iterable[tuple[_KT, _VT]], /) -> None: ...
# **kwargs are allowed when _KT is str
@overload
def update(self: MutableMapping[str, _VT], m: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ...
@overload
def update(self: MutableMapping[str, _VT], m: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ...
@overload
def update(self: MutableMapping[str, _VT], **kwargs: _VT) -> None: ...
See the current overloads for MutableMapping.update here:
Lines 749 to 754 in 3db7f01