mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 05:22:23 +08:00
Harmonise UserDict.fromkeys with dict.fromkeys (#6488)
This commit is contained in:
@@ -45,8 +45,15 @@ class UserDict(MutableMapping[_KT, _VT]):
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __contains__(self, key: object) -> bool: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
# `UserDict.fromkeys` has the same semantics as `dict.fromkeys`, so should be kept in line with `dict.fromkeys`.
|
||||
# TODO: Much like `dict.fromkeys`, the true signature of `UserDict.fromkeys` is inexpressable in the current type system.
|
||||
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
|
||||
@classmethod
|
||||
def fromkeys(cls: Type[Self], iterable: Iterable[_KT], value: _VT | None = ...) -> Self: ...
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> UserDict[_T, Any | None]: ...
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ...
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
data: list[_T]
|
||||
|
||||
Reference in New Issue
Block a user