summaryrefslogtreecommitdiff
path: root/numpy/_array_api
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/_array_api')
-rw-r--r--numpy/_array_api/_array_object.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py
index 797f9ea4f..a58063698 100644
--- a/numpy/_array_api/_array_object.py
+++ b/numpy/_array_api/_array_object.py
@@ -494,8 +494,10 @@ class Array:
res = self._array.__pos__()
return self.__class__._new(res)
+ # PEP 484 requires int to be a subtype of float, but __pow__ should not
+ # accept int.
@np.errstate(all='ignore')
- def __pow__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __pow__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __pow__.
"""
@@ -543,8 +545,10 @@ class Array:
res = self._array.__sub__(other._array)
return self.__class__._new(res)
+ # PEP 484 requires int to be a subtype of float, but __truediv__ should
+ # not accept int.
@np.errstate(all='ignore')
- def __truediv__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __truediv__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __truediv__.
"""
@@ -742,7 +746,7 @@ class Array:
return self.__class__._new(res)
@np.errstate(all='ignore')
- def __ipow__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __ipow__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __ipow__.
"""
@@ -754,7 +758,7 @@ class Array:
return self
@np.errstate(all='ignore')
- def __rpow__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __rpow__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __rpow__.
"""
@@ -812,7 +816,7 @@ class Array:
return self.__class__._new(res)
@np.errstate(all='ignore')
- def __itruediv__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __itruediv__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __itruediv__.
"""
@@ -824,7 +828,7 @@ class Array:
return self
@np.errstate(all='ignore')
- def __rtruediv__(self: Array, other: Union[int, float, Array], /) -> Array:
+ def __rtruediv__(self: Array, other: Union[float, Array], /) -> Array:
"""
Performs the operation __rtruediv__.
"""