mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Fix stubtest complaints for various .get() methods (#10690)
This commit is contained in:
@@ -96,6 +96,11 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@overload
|
||||
def get(self, key: _KT, default: None = None) -> _VT | None: ...
|
||||
@overload
|
||||
def get(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
data: list[_T]
|
||||
@@ -422,6 +427,10 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, key: object) -> bool: ...
|
||||
@overload
|
||||
def get(self, key: _KT, default: None = None) -> _VT | None: ...
|
||||
@overload
|
||||
def get(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ... # undocumented
|
||||
def __bool__(self) -> bool: ...
|
||||
# Keep ChainMap.setdefault in line with MutableMapping.setdefault, modulo positional-only differences.
|
||||
|
||||
Reference in New Issue
Block a user