mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
collections.OrderedDict dict views are reversible (#2079)
Add the *View subclasses for OrderedDict use, with appropriate __reversed__ hints. Fixes python/typeshed#2078
This commit is contained in:
committed by
Jelle Zijlstra
parent
664d30c44b
commit
ecae01a37d
@@ -285,11 +285,18 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
|
||||
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
|
||||
|
||||
class _OrderedDictKeysView(KeysView[_KT], Reversible[_KT]): ...
|
||||
class _OrderedDictItemsView(ItemsView[_KT, _VT], Reversible[Tuple[_KT, _VT]]): ...
|
||||
class _OrderedDictValuesView(ValuesView[_VT], Reversible[_VT]): ...
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = ...) -> None: ...
|
||||
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def keys(self) -> _OrderedDictKeysView[_KT]: ...
|
||||
def items(self) -> _OrderedDictItemsView[_KT, _VT]: ...
|
||||
def values(self) -> _OrderedDictValuesView[_VT]: ...
|
||||
|
||||
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user