Use Any instead of object in the view types for __and__ and __sub__ (#3294)

This was discussed in #3181 and the correct explanation was given that
object ought to be preferred here. In practice this caused an obscure
issue with mypy when using this operations on the results of
six.viewkeys(), since it decided that it wanted a mapping *from* object
as a result of inference contexts. Grumble.
This commit is contained in:
Michael J. Sullivan authored and Sebastian Rittau committed 2019-10-02 08:03:57 +02:00
1 parent ad881f94d7
commit 455f25a5c7
1 file changed
+4 -4
+4 -4
View File
@@ -335,25 +335,25 @@ class MappingView:
def __len__(self) -> int: ...
class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):
def __and__(self, o: Iterable[object]) -> Set[Tuple[_KT_co, _VT_co]]: ...
def __and__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...
def __rand__(self, o: Iterable[_T]) -> Set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
def __or__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
def __ror__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
def __sub__(self, o: Iterable[object]) -> Set[Tuple[_KT_co, _VT_co]]: ...
def __sub__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...
def __rsub__(self, o: Iterable[_T]) -> Set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
def __rxor__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
def __and__(self, o: Iterable[object]) -> Set[_KT_co]: ...
def __and__(self, o: Iterable[Any]) -> Set[_KT_co]: ...
def __rand__(self, o: Iterable[_T]) -> Set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT_co]: ...
def __or__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
def __ror__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
def __sub__(self, o: Iterable[object]) -> Set[_KT_co]: ...
def __sub__(self, o: Iterable[Any]) -> Set[_KT_co]: ...
def __rsub__(self, o: Iterable[_T]) -> Set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
def __rxor__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...