mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Add OrderedDict.fromkeys (#6485)
This commit is contained in:
@@ -777,11 +777,13 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def append(self, __object: _T) -> None: ...
|
||||
def extend(self, __iterable: Iterable[_T]) -> None: ...
|
||||
def pop(self, __index: SupportsIndex = ...) -> _T: ...
|
||||
# Signature of `list.index` should be kept in line with `collections.UserList.index()`
|
||||
def index(self, __value: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ...
|
||||
def count(self, __value: _T) -> int: ...
|
||||
def insert(self, __index: SupportsIndex, __object: _T) -> None: ...
|
||||
def remove(self, __value: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
# Signature of `list.sort` should be kept inline with `collections.UserList.sort()`
|
||||
@overload
|
||||
def sort(self: list[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...
|
||||
@overload
|
||||
@@ -840,6 +842,9 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def keys(self) -> dict_keys[_KT, _VT]: ...
|
||||
def values(self) -> dict_values[_KT, _VT]: ...
|
||||
def items(self) -> dict_items[_KT, _VT]: ...
|
||||
# Signature of `dict.fromkeys` should be kept identical to `fromkeys` methods in `collections.OrderedDict`/`collections.ChainMap`
|
||||
# TODO: the true signature of `dict.fromkeys` is not expressable in the current type system.
|
||||
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ...
|
||||
|
||||
Reference in New Issue
Block a user