Make Mapping.get(default) more constrained (#14360)

This commit is contained in:
Neil Mitchell
2025-07-02 11:24:32 +01:00
committed by GitHub
parent 75d8c88ec5
commit dbd3ad356e
12 changed files with 39 additions and 8 deletions
+3 -1
View File
@@ -323,7 +323,9 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
@overload
def get(self, key: _KT, /) -> _VT_co | None: ...
@overload
def get(self, key: _KT, default: _VT_co | _T2, /) -> _VT_co | _T2: ...
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
@overload
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __reversed__(self) -> Iterator[_KT]: ...
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...