Skip to content

Commit 37bf553

Browse files
authored
Merge pull request #20720 from rgommers/arrayapi-annotation-fixes
TYP: add a few type annotations to `numpy.array_api.Array` Original NumPy Commit: e1123b2d2cf77d123266604328baa3a27c375cf8
2 parents 5b218ac + 26428e4 commit 37bf553

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

array_api_strict/_array_object.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Array:
5656
functions, such as asarray().
5757
5858
"""
59+
_array: np.ndarray
5960

6061
# Use a custom constructor instead of __init__, as manually initializing
6162
# this class is not supported API.
@@ -125,7 +126,7 @@ def __array__(self, dtype: None | np.dtype[Any] = None) -> npt.NDArray[Any]:
125126
# spec in places where it either deviates from or is more strict than
126127
# NumPy behavior
127128

128-
def _check_allowed_dtypes(self, other, dtype_category, op):
129+
def _check_allowed_dtypes(self, other: bool | int | float | Array, dtype_category: str, op: str) -> Array:
129130
"""
130131
Helper function for operators to only allow specific input dtypes
131132
@@ -201,7 +202,7 @@ def _promote_scalar(self, scalar):
201202
return Array._new(np.array(scalar, self.dtype))
202203

203204
@staticmethod
204-
def _normalize_two_args(x1, x2):
205+
def _normalize_two_args(x1, x2) -> Tuple[Array, Array]:
205206
"""
206207
Normalize inputs to two arg functions to fix type promotion rules
207208

0 commit comments

Comments
 (0)