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
@@ -745,7 +745,9 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
@overload
def get(self, key: _KT, /) -> _VT_co | None: ...
@overload
def get(self, key: _KT, /, default: _VT_co | _T) -> _VT_co | _T: ...
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: _T) -> _VT_co | _T: ...
def items(self) -> ItemsView[_KT, _VT_co]: ...
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT_co]: ...