summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2020-11-19 12:26:55 +0100
committerBas van Beek <b.f.van.beek@vu.nl>2020-11-19 12:40:15 +0100
commitfd4e1e1bd6e3be716416afa6f91dcf66b071bb48 (patch)
tree90498fd1565ee3869fbcf7db65278c9b5ffdbdfe
parentb88b2c0c19851810d4ee07f03a7734b6e19dbdaa (diff)
downloadnumpy-fd4e1e1bd6e3be716416afa6f91dcf66b071bb48.tar.gz
MAINT: Set the ufunc and ndarray ops return type to `Any`
-rw-r--r--numpy/__init__.pyi70
-rw-r--r--numpy/typing/tests/data/reveal/arithmetic.py38
-rw-r--r--numpy/typing/tests/data/reveal/bitwise_ops.py32
-rw-r--r--numpy/typing/tests/data/reveal/mod.py32
4 files changed, 84 insertions, 88 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index 579dd03d6..2366e9b75 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -1579,43 +1579,39 @@ class ndarray(_ArrayOrScalarCommon, Iterable, Sized, Container):
def __iter__(self) -> Any: ...
def __contains__(self, key) -> bool: ...
def __index__(self) -> int: ...
- def __matmul__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
+ def __matmul__(self, other: ArrayLike) -> Any: ...
# NOTE: `ndarray` does not implement `__imatmul__`
- def __rmatmul__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __neg__(self: _ArraySelf) -> Union[_ArraySelf, generic]: ...
- def __pos__(self: _ArraySelf) -> Union[_ArraySelf, generic]: ...
- def __abs__(self: _ArraySelf) -> Union[_ArraySelf, generic]: ...
- def __mod__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rmod__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __divmod__(
- self, other: ArrayLike
- ) -> Union[Tuple[ndarray, ndarray], Tuple[generic, generic]]: ...
- def __rdivmod__(
- self, other: ArrayLike
- ) -> Union[Tuple[ndarray, ndarray], Tuple[generic, generic]]: ...
- def __add__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __radd__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __sub__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rsub__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __mul__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rmul__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __floordiv__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rfloordiv__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __pow__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rpow__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __truediv__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __rtruediv__(self, other: ArrayLike) -> Union[ndarray, generic]: ...
- def __invert__(self: _ArraySelf) -> Union[_ArraySelf, integer, bool_]: ...
- def __lshift__(self, other: ArrayLike) -> Union[ndarray, integer]: ...
- def __rlshift__(self, other: ArrayLike) -> Union[ndarray, integer]: ...
- def __rshift__(self, other: ArrayLike) -> Union[ndarray, integer]: ...
- def __rrshift__(self, other: ArrayLike) -> Union[ndarray, integer]: ...
- def __and__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
- def __rand__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
- def __xor__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
- def __rxor__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
- def __or__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
- def __ror__(self, other: ArrayLike) -> Union[ndarray, integer, bool_]: ...
+ def __rmatmul__(self, other: ArrayLike) -> Any: ...
+ def __neg__(self: _ArraySelf) -> Any: ...
+ def __pos__(self: _ArraySelf) -> Any: ...
+ def __abs__(self: _ArraySelf) -> Any: ...
+ def __mod__(self, other: ArrayLike) -> Any: ...
+ def __rmod__(self, other: ArrayLike) -> Any: ...
+ def __divmod__(self, other: ArrayLike) -> Tuple[Any, Any]: ...
+ def __rdivmod__(self, other: ArrayLike) -> Tuple[Any, Any]: ...
+ def __add__(self, other: ArrayLike) -> Any: ...
+ def __radd__(self, other: ArrayLike) -> Any: ...
+ def __sub__(self, other: ArrayLike) -> Any: ...
+ def __rsub__(self, other: ArrayLike) -> Any: ...
+ def __mul__(self, other: ArrayLike) -> Any: ...
+ def __rmul__(self, other: ArrayLike) -> Any: ...
+ def __floordiv__(self, other: ArrayLike) -> Any: ...
+ def __rfloordiv__(self, other: ArrayLike) -> Any: ...
+ def __pow__(self, other: ArrayLike) -> Any: ...
+ def __rpow__(self, other: ArrayLike) -> Any: ...
+ def __truediv__(self, other: ArrayLike) -> Any: ...
+ def __rtruediv__(self, other: ArrayLike) -> Any: ...
+ def __invert__(self: _ArraySelf) -> Any: ...
+ def __lshift__(self, other: ArrayLike) -> Any: ...
+ def __rlshift__(self, other: ArrayLike) -> Any: ...
+ def __rshift__(self, other: ArrayLike) -> Any: ...
+ def __rrshift__(self, other: ArrayLike) -> Any: ...
+ def __and__(self, other: ArrayLike) -> Any: ...
+ def __rand__(self, other: ArrayLike) -> Any: ...
+ def __xor__(self, other: ArrayLike) -> Any: ...
+ def __rxor__(self, other: ArrayLike) -> Any: ...
+ def __or__(self, other: ArrayLike) -> Any: ...
+ def __ror__(self, other: ArrayLike) -> Any: ...
# `np.generic` does not support inplace operations
def __iadd__(self: _ArraySelf, other: ArrayLike) -> _ArraySelf: ...
def __isub__(self: _ArraySelf, other: ArrayLike) -> _ArraySelf: ...
@@ -2086,7 +2082,7 @@ class ufunc:
# int, an int, and a callable, but there's no way to express
# that.
extobj: List[Union[int, Callable]] = ...,
- ) -> Union[ndarray, generic]: ...
+ ) -> Any: ...
@property
def nin(self) -> int: ...
@property
diff --git a/numpy/typing/tests/data/reveal/arithmetic.py b/numpy/typing/tests/data/reveal/arithmetic.py
index 8a133c136..20310e691 100644
--- a/numpy/typing/tests/data/reveal/arithmetic.py
+++ b/numpy/typing/tests/data/reveal/arithmetic.py
@@ -34,7 +34,7 @@ reveal_type(-i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(-u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(-u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(-td) # E: numpy.timedelta64
-reveal_type(-AR) # E: Union[numpy.ndarray*, numpy.generic]
+reveal_type(-AR) # E: Any
reveal_type(+c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(+c8) # E: numpy.complexfloating[numpy.typing._32Bit, numpy.typing._32Bit]
@@ -45,7 +45,7 @@ reveal_type(+i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(+u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(+u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(+td) # E: numpy.timedelta64
-reveal_type(+AR) # E: Union[numpy.ndarray*, numpy.generic]
+reveal_type(+AR) # E: Any
reveal_type(abs(c16)) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(abs(c8)) # E: numpy.floating[numpy.typing._32Bit]
@@ -57,7 +57,7 @@ reveal_type(abs(u8)) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(abs(u4)) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(abs(td)) # E: numpy.timedelta64
reveal_type(abs(b_)) # E: numpy.bool_
-reveal_type(abs(AR)) # E: Union[numpy.ndarray*, numpy.generic]
+reveal_type(abs(AR)) # E: Any
# Time structures
@@ -127,7 +127,7 @@ reveal_type(c16 + b) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typi
reveal_type(c16 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(c16 + f) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(c16 + i) # E: numpy.complexfloating[Any, Any]
-reveal_type(c16 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(c16 + AR) # E: Any
reveal_type(c16 + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f8 + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
@@ -140,7 +140,7 @@ reveal_type(b + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typi
reveal_type(c + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(i + c16) # E: numpy.complexfloating[Any, Any]
-reveal_type(AR + c16) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + c16) # E: Any
reveal_type(c8 + c16) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(c8 + f8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
@@ -153,7 +153,7 @@ reveal_type(c8 + b) # E: numpy.complexfloating[numpy.typing._32Bit, numpy.typin
reveal_type(c8 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(c8 + f) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(c8 + i) # E: numpy.complexfloating[Any, Any]
-reveal_type(c8 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(c8 + AR) # E: Any
reveal_type(c16 + c8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f8 + c8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
@@ -166,7 +166,7 @@ reveal_type(b + c8) # E: numpy.complexfloating[numpy.typing._32Bit, numpy.typin
reveal_type(c + c8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + c8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(i + c8) # E: numpy.complexfloating[Any, Any]
-reveal_type(AR + c8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + c8) # E: Any
# Float
@@ -179,7 +179,7 @@ reveal_type(f8 + b) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f8 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f8 + f) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f8 + i) # E: numpy.floating[Any]
-reveal_type(f8 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(f8 + AR) # E: Any
reveal_type(f8 + f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i8 + f8) # E: numpy.floating[numpy.typing._64Bit]
@@ -190,7 +190,7 @@ reveal_type(b + f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(c + f8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i + f8) # E: numpy.floating[Any]
-reveal_type(AR + f8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + f8) # E: Any
reveal_type(f4 + f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f4 + i8) # E: numpy.floating[numpy.typing._64Bit]
@@ -201,7 +201,7 @@ reveal_type(f4 + b) # E: numpy.floating[numpy.typing._32Bit]
reveal_type(f4 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f4 + f) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f4 + i) # E: numpy.floating[Any]
-reveal_type(f4 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(f4 + AR) # E: Any
reveal_type(f8 + f4) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i8 + f4) # E: numpy.floating[numpy.typing._64Bit]
@@ -212,7 +212,7 @@ reveal_type(b + f4) # E: umpy.floating[numpy.typing._32Bit]
reveal_type(c + f4) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + f4) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i + f4) # E: numpy.floating[Any]
-reveal_type(AR + f4) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + f4) # E: Any
# Int
@@ -225,7 +225,7 @@ reveal_type(i8 + b) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i8 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(i8 + f) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i8 + i) # E: numpy.signedinteger[Any]
-reveal_type(i8 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(i8 + AR) # E: Any
reveal_type(u8 + u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(u8 + i4) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
@@ -235,7 +235,7 @@ reveal_type(u8 + b) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(u8 + c) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(u8 + f) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(u8 + i) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
-reveal_type(u8 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(u8 + AR) # E: Any
reveal_type(i8 + i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(u8 + i8) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
@@ -246,7 +246,7 @@ reveal_type(b + i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(c + i8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + i8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i + i8) # E: numpy.signedinteger[Any]
-reveal_type(AR + i8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + i8) # E: Any
reveal_type(u8 + u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(i4 + u8) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
@@ -256,14 +256,14 @@ reveal_type(b + u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(c + u8) # E: numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]
reveal_type(f + u8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i + u8) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
-reveal_type(AR + u8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + u8) # E: Any
reveal_type(i4 + i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i4 + i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(i4 + i) # E: numpy.signedinteger[Any]
reveal_type(i4 + b_) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(i4 + b) # E: numpy.signedinteger[numpy.typing._32Bit]
-reveal_type(i4 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(i4 + AR) # E: Any
reveal_type(u4 + i8) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
reveal_type(u4 + i4) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
@@ -272,14 +272,14 @@ reveal_type(u4 + u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(u4 + i) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
reveal_type(u4 + b_) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(u4 + b) # E: numpy.unsignedinteger[numpy.typing._32Bit]
-reveal_type(u4 + AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(u4 + AR) # E: Any
reveal_type(i8 + i4) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i4 + i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(i + i4) # E: numpy.signedinteger[Any]
reveal_type(b_ + i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(b + i4) # E: numpy.signedinteger[numpy.typing._32Bit]
-reveal_type(AR + i4) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + i4) # E: Any
reveal_type(i8 + u4) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
reveal_type(i4 + u4) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
@@ -288,4 +288,4 @@ reveal_type(u4 + u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(b_ + u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(b + u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(i + u4) # E: Union[numpy.signedinteger[Any], numpy.floating[numpy.typing._64Bit]]
-reveal_type(AR + u4) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR + u4) # E: Any
diff --git a/numpy/typing/tests/data/reveal/bitwise_ops.py b/numpy/typing/tests/data/reveal/bitwise_ops.py
index 6883532f2..cb9131a96 100644
--- a/numpy/typing/tests/data/reveal/bitwise_ops.py
+++ b/numpy/typing/tests/data/reveal/bitwise_ops.py
@@ -21,11 +21,11 @@ reveal_type(i8 | i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i8 ^ i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i8 & i8) # E: numpy.signedinteger[numpy.typing._64Bit]
-reveal_type(i8 << AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(i8 >> AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(i8 | AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(i8 ^ AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(i8 & AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
+reveal_type(i8 << AR) # E: Any
+reveal_type(i8 >> AR) # E: Any
+reveal_type(i8 | AR) # E: Any
+reveal_type(i8 ^ AR) # E: Any
+reveal_type(i8 & AR) # E: Any
reveal_type(i4 << i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(i4 >> i4) # E: numpy.signedinteger[numpy.typing._32Bit]
@@ -63,11 +63,11 @@ reveal_type(u8 | u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(u8 ^ u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(u8 & u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
-reveal_type(u8 << AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(u8 >> AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(u8 | AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(u8 ^ AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(u8 & AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
+reveal_type(u8 << AR) # E: Any
+reveal_type(u8 >> AR) # E: Any
+reveal_type(u8 | AR) # E: Any
+reveal_type(u8 ^ AR) # E: Any
+reveal_type(u8 & AR) # E: Any
reveal_type(u4 << u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(u4 >> u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
@@ -105,11 +105,11 @@ reveal_type(b_ | b_) # E: numpy.bool_
reveal_type(b_ ^ b_) # E: numpy.bool_
reveal_type(b_ & b_) # E: numpy.bool_
-reveal_type(b_ << AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(b_ >> AR) # E: Union[numpy.ndarray, numpy.integer[Any]]
-reveal_type(b_ | AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(b_ ^ AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
-reveal_type(b_ & AR) # E: Union[numpy.ndarray, numpy.integer[Any], numpy.bool_]
+reveal_type(b_ << AR) # E: Any
+reveal_type(b_ >> AR) # E: Any
+reveal_type(b_ | AR) # E: Any
+reveal_type(b_ ^ AR) # E: Any
+reveal_type(b_ & AR) # E: Any
reveal_type(b_ << b) # E: numpy.signedinteger[numpy.typing._8Bit]
reveal_type(b_ >> b) # E: numpy.signedinteger[numpy.typing._8Bit]
@@ -128,4 +128,4 @@ reveal_type(~i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(~u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(~u4) # E: numpy.unsignedinteger[numpy.typing._32Bit]
reveal_type(~b_) # E: numpy.bool_
-reveal_type(~AR) # E: Union[numpy.ndarray*, numpy.integer[Any], numpy.bool_]
+reveal_type(~AR) # E: Any
diff --git a/numpy/typing/tests/data/reveal/mod.py b/numpy/typing/tests/data/reveal/mod.py
index 9cd2c2fcf..4292041f8 100644
--- a/numpy/typing/tests/data/reveal/mod.py
+++ b/numpy/typing/tests/data/reveal/mod.py
@@ -24,12 +24,12 @@ AR2.setflags(write=False)
# Time structures
reveal_type(td % td) # E: numpy.timedelta64
-reveal_type(AR2 % td) # E: Union[numpy.ndarray, numpy.generic]
-reveal_type(td % AR2) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR2 % td) # E: Any
+reveal_type(td % AR2) # E: Any
reveal_type(divmod(td, td)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.timedelta64]
-reveal_type(divmod(AR2, td)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
-reveal_type(divmod(td, AR2)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(AR2, td)) # E: Tuple[Any, Any]
+reveal_type(divmod(td, AR2)) # E: Tuple[Any, Any]
# Bool
@@ -40,7 +40,7 @@ reveal_type(b_ % b_) # E: numpy.signedinteger[numpy.typing._8Bit]
reveal_type(b_ % i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(b_ % u8) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(b_ % f8) # E: numpy.floating[numpy.typing._64Bit]
-reveal_type(b_ % AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(b_ % AR) # E: Any
reveal_type(divmod(b_, b)) # E: Tuple[numpy.signedinteger[numpy.typing._8Bit], numpy.signedinteger[numpy.typing._8Bit]]
reveal_type(divmod(b_, i)) # E: Tuple[numpy.signedinteger[Any], numpy.signedinteger[Any]]
@@ -49,7 +49,7 @@ reveal_type(divmod(b_, b_)) # E: Tuple[numpy.signedinteger[numpy.typing._8Bit],
reveal_type(divmod(b_, i8)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.signedinteger[numpy.typing._64Bit]]
reveal_type(divmod(b_, u8)) # E: Tuple[numpy.unsignedinteger[numpy.typing._64Bit], numpy.unsignedinteger[numpy.typing._64Bit]]
reveal_type(divmod(b_, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
-reveal_type(divmod(b_, AR)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(b_, AR)) # E: Tuple[Any, Any]
reveal_type(b % b_) # E: numpy.signedinteger[numpy.typing._8Bit]
reveal_type(i % b_) # E: numpy.signedinteger[Any]
@@ -58,7 +58,7 @@ reveal_type(b_ % b_) # E: numpy.signedinteger[numpy.typing._8Bit]
reveal_type(i8 % b_) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(u8 % b_) # E: numpy.unsignedinteger[numpy.typing._64Bit]
reveal_type(f8 % b_) # E: numpy.floating[numpy.typing._64Bit]
-reveal_type(AR % b_) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR % b_) # E: Any
reveal_type(divmod(b, b_)) # E: Tuple[numpy.signedinteger[numpy.typing._8Bit], numpy.signedinteger[numpy.typing._8Bit]]
reveal_type(divmod(i, b_)) # E: Tuple[numpy.signedinteger[Any], numpy.signedinteger[Any]]
@@ -67,7 +67,7 @@ reveal_type(divmod(b_, b_)) # E: Tuple[numpy.signedinteger[numpy.typing._8Bit],
reveal_type(divmod(i8, b_)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.signedinteger[numpy.typing._64Bit]]
reveal_type(divmod(u8, b_)) # E: Tuple[numpy.unsignedinteger[numpy.typing._64Bit], numpy.unsignedinteger[numpy.typing._64Bit]]
reveal_type(divmod(f8, b_)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
-reveal_type(divmod(AR, b_)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(AR, b_)) # E: Tuple[Any, Any]
# int
@@ -80,7 +80,7 @@ reveal_type(i4 % i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i4 % f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i4 % i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(i4 % f4) # E: numpy.floating[numpy.typing._32Bit]
-reveal_type(i8 % AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(i8 % AR) # E: Any
reveal_type(divmod(i8, b)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.signedinteger[numpy.typing._64Bit]]
reveal_type(divmod(i8, i)) # E: Tuple[numpy.signedinteger[Any], numpy.signedinteger[Any]]
@@ -91,7 +91,7 @@ reveal_type(divmod(i8, i4)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit]
reveal_type(divmod(i8, f4)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(i4, i4)) # E: Tuple[numpy.signedinteger[numpy.typing._32Bit], numpy.signedinteger[numpy.typing._32Bit]]
reveal_type(divmod(i4, f4)) # E: Tuple[numpy.floating[numpy.typing._32Bit], numpy.floating[numpy.typing._32Bit]]
-reveal_type(divmod(i8, AR)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(i8, AR)) # E: Tuple[Any, Any]
reveal_type(b % i8) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(i % i8) # E: numpy.signedinteger[Any]
@@ -102,7 +102,7 @@ reveal_type(i8 % i4) # E: numpy.signedinteger[numpy.typing._64Bit]
reveal_type(f8 % i4) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i4 % i4) # E: numpy.signedinteger[numpy.typing._32Bit]
reveal_type(f4 % i4) # E: numpy.floating[numpy.typing._32Bit]
-reveal_type(AR % i8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR % i8) # E: Any
reveal_type(divmod(b, i8)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.signedinteger[numpy.typing._64Bit]]
reveal_type(divmod(i, i8)) # E: Tuple[numpy.signedinteger[Any], numpy.signedinteger[Any]]
@@ -113,7 +113,7 @@ reveal_type(divmod(i4, i8)) # E: Tuple[numpy.signedinteger[numpy.typing._64Bit]
reveal_type(divmod(f4, i8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(i4, i4)) # E: Tuple[numpy.signedinteger[numpy.typing._32Bit], numpy.signedinteger[numpy.typing._32Bit]]
reveal_type(divmod(f4, i4)) # E: Tuple[numpy.floating[numpy.typing._32Bit], numpy.floating[numpy.typing._32Bit]]
-reveal_type(divmod(AR, i8)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(AR, i8)) # E: Tuple[Any, Any]
# float
@@ -122,7 +122,7 @@ reveal_type(f8 % i) # E: numpy.floating[Any]
reveal_type(f8 % f) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i8 % f4) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f4 % f4) # E: numpy.floating[numpy.typing._32Bit]
-reveal_type(f8 % AR) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(f8 % AR) # E: Any
reveal_type(divmod(f8, b)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(f8, i)) # E: Tuple[numpy.floating[Any], numpy.floating[Any]]
@@ -130,7 +130,7 @@ reveal_type(divmod(f8, f)) # E: Tuple[numpy.floating[numpy.typing._64Bit], nump
reveal_type(divmod(f8, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(f8, f4)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(f4, f4)) # E: Tuple[numpy.floating[numpy.typing._32Bit], numpy.floating[numpy.typing._32Bit]]
-reveal_type(divmod(f8, AR)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(f8, AR)) # E: Tuple[Any, Any]
reveal_type(b % f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(i % f8) # E: numpy.floating[Any]
@@ -138,7 +138,7 @@ reveal_type(f % f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f8 % f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f8 % f8) # E: numpy.floating[numpy.typing._64Bit]
reveal_type(f4 % f4) # E: numpy.floating[numpy.typing._32Bit]
-reveal_type(AR % f8) # E: Union[numpy.ndarray, numpy.generic]
+reveal_type(AR % f8) # E: Any
reveal_type(divmod(b, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(i, f8)) # E: Tuple[numpy.floating[Any], numpy.floating[Any]]
@@ -146,4 +146,4 @@ reveal_type(divmod(f, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], nump
reveal_type(divmod(f8, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(f4, f8)) # E: Tuple[numpy.floating[numpy.typing._64Bit], numpy.floating[numpy.typing._64Bit]]
reveal_type(divmod(f4, f4)) # E: Tuple[numpy.floating[numpy.typing._32Bit], numpy.floating[numpy.typing._32Bit]]
-reveal_type(divmod(AR, f8)) # E: Union[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.generic, numpy.generic]]
+reveal_type(divmod(AR, f8)) # E: Tuple[Any, Any]