More precise overloads for get/pop methods (#10501)

Fixes #10293

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
This commit is contained in:
Eugene Toder
2023-07-26 11:37:32 -04:00
committed by GitHub
parent 21e8f7b02b
commit e86c61da86
7 changed files with 38 additions and 14 deletions

View File

@@ -432,7 +432,9 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
@overload
def pop(self, key: _KT) -> _VT: ...
@overload
def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ...
def pop(self, key: _KT, default: _VT) -> _VT: ...
@overload
def pop(self, key: _KT, default: _T) -> _VT | _T: ...
def copy(self) -> Self: ...
__copy__ = copy
# All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime, so the signature should be kept in line with `dict.fromkeys`.