Add various __*or__ methods, and improve dict.__ior__ (#6961)

This commit is contained in:
Alex Waygood
2022-01-19 11:24:16 +00:00
committed by GitHub
parent 30580a3732
commit 2170693e11
4 changed files with 51 additions and 1 deletions

View File

@@ -481,6 +481,14 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
# mypy will commit to using the first overload when the argument is
# known to be a Mapping with unknown type parameters, which is closer
# to the behavior we want. See mypy issue #1430.
#
# Various mapping classes have __ior__ methods that should be kept roughly in line with .update():
# -- dict.__ior__
# -- os._Environ.__ior__
# -- collections.UserDict.__ior__
# -- collections.ChainMap.__ior__
# -- weakref.WeakValueDictionary.__ior__
# -- weakref.WeakKeyDictionary.__ior__
@overload
def update(self, __m: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ...
@overload