8000 Make Mapping.get(default) more constrained by ndmitchell · Pull Request #14360 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Make Mapping.get(default) more constrained #14360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Generailse type ignores
Summary:

Test Plan:
  • Loading branch information
ndmitchell committed Jul 2, 2025
commit 8fa52d9c9b7180ad808582c29b6c313e053400b6
2 changes: 1 addition & 1 deletion stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
@overload
def get(self, key: _KT, /) -> _VT_co | None: ...
@overload
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # Covariant type as parameter
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore # Covariant type as parameter
@overload
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ 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) -> _VT_co: ... # type: ignore[misc] # Covariant type as parameter
def get(self, key: _KT, /, default: _VT_co) -> _VT_co: ... # type: ignore # Covariant type as parameter
@overload
def get(self, key: _KT, /, default: _T) -> _VT_co | _T: ...
def items(self) -> ItemsView[_KT, _VT_co]: ...
Expand Down
0