Improve the accuracy of (default)dict.__(r)or__ (#10679)

This commit is contained in:
Alex Waygood
2023-09-08 11:22:17 +01:00
committed by GitHub
parent aa39b996e9
commit 6eec191739
4 changed files with 143 additions and 8 deletions

View File

@@ -402,13 +402,13 @@ class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]):
def copy(self) -> Self: ...
if sys.version_info >= (3, 9):
@overload
def __or__(self, __value: Mapping[_KT, _VT]) -> Self: ...
def __or__(self, __value: dict[_KT, _VT]) -> Self: ...
@overload
def __or__(self, __value: Mapping[_T1, _T2]) -> defaultdict[_KT | _T1, _VT | _T2]: ...
def __or__(self, __value: dict[_T1, _T2]) -> defaultdict[_KT | _T1, _VT | _T2]: ...
@overload
def __ror__(self, __value: Mapping[_KT, _VT]) -> Self: ...
def __ror__(self, __value: dict[_KT, _VT]) -> Self: ...
@overload
def __ror__(self, __value: Mapping[_T1, _T2]) -> defaultdict[_KT | _T1, _VT | _T2]: ...
def __ror__(self, __value: dict[_T1, _T2]) -> defaultdict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
maps: list[MutableMapping[_KT, _VT]]