From c760a4e9494c37b4d5c2b067bcbc2b7107da4702 Mon Sep 17 00:00:00 2001 From: Mike Patek Date: Wed, 1 Feb 2017 12:23:43 -0500 Subject: [PATCH] Make OrderedDict inherit from Reversible (#912) Fixes #904 --- stdlib/2/collections.pyi | 3 ++- stdlib/3/collections/__init__.pyi | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stdlib/2/collections.pyi b/stdlib/2/collections.pyi index c2f0af268..3235e9bd1 100644 --- a/stdlib/2/collections.pyi +++ b/stdlib/2/collections.pyi @@ -70,9 +70,10 @@ class Counter(Dict[_T, int], Generic[_T]): @overload def update(self, m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: _VT) -> None: ... -class OrderedDict(Dict[_KT, _VT], Generic[_KT, _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 __reversed__(self) -> Iterator[_KT]: ... class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): default_factory = ... # type: Callable[[], _VT] diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 5cb89f7a3..0f059ec3d 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -139,10 +139,10 @@ class Counter(Dict[_T, int], Generic[_T]): def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... -class OrderedDict(Dict[_KT, _VT], Generic[_KT, _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 __reversed__(self) -> Iterator[_KT]: ... class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): default_factory = ... # type: Callable[[], _VT]