mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
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:
committed by
Sebastian Rittau
parent
ad881f94d7
commit
455f25a5c7
@@ -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]]: ...
|
||||
|
||||
Reference in New Issue
Block a user