From 07d4938251b5f1eda9cb6903bd8754f4cf39865c Mon Sep 17 00:00:00 2001 From: Viktor Roytman Date: Sun, 19 May 2019 20:12:22 -0400 Subject: [PATCH] Add missing methods to ItemsView and KeysView, including isdisjoint (#2997) --- stdlib/3/typing.pyi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index c99c1f99a..e83640a73 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -312,8 +312,7 @@ class AbstractSet(_Collection[_T_co], Generic[_T_co]): def __or__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ... def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ... def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ... - # TODO: Argument can be a more general ABC? - def isdisjoint(self, s: AbstractSet[Any]) -> bool: ... + def isdisjoint(self, s: Iterable[Any]) -> bool: ... class MutableSet(AbstractSet[_T], Generic[_T]): @abstractmethod @@ -334,17 +333,27 @@ class MappingView: class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): def __and__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... + def __rand__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ... def __or__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... + def __ror__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... + def __sub__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... + def __rsub__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... def __xor__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... + def __rxor__(self, o: Iterable[_T]) -> AbstractSet[Union[Tuple[_KT_co, _VT_co], _T]]: ... class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]): def __and__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... + def __rand__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_KT_co]: ... def __or__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... + def __ror__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... + def __sub__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... + def __rsub__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... def __xor__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... + def __rxor__(self, o: Iterable[_T]) -> AbstractSet[Union[_KT_co, _T]]: ... class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): def __contains__(self, o: object) -> bool: ...