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
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
Update weakref.pyi
  • Loading branch information
ndmitchell authored Jul 1, 2025
commit 1307310cdb99186485757e81b32728419671e9f1
8 changes: 6 additions & 2 deletions stdlib/weakref.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _T: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore[override]
def values(self) -> Iterator[_VT]: ... # type: ignore[override]
Expand Down Expand Up @@ -149,7 +151,9 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _T: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore[override]
def values(self) -> Iterator[_VT]: ... # type: ignore[override]
Expand Down
0