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

@@ -869,7 +869,11 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
def __or__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
def __ior__(self, __value: Mapping[_KT, _VT]) -> dict[_KT, _VT]: ... # type: ignore[misc]
# dict.__ior__ should be kept roughly in line with MutableMapping.update()
@overload # type: ignore[misc]
def __ior__(self: Self, __value: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
@overload
def __ior__(self: Self, __value: Iterable[tuple[_KT, _VT]]) -> Self: ...
class set(MutableSet[_T], Generic[_T]):
def __init__(self, __iterable: Iterable[_T] = ...) -> None: ...