diff options
author | Matti Picus <matti.picus@gmail.com> | 2022-01-04 12:51:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 12:51:09 +0200 |
commit | e1123b2d2cf77d123266604328baa3a27c375cf8 (patch) | |
tree | 80ba45cb93fb7987261bdc05f3e0238163bf854e /numpy/array_api/_array_object.py | |
parent | d44194baa67bc88c9129cc8091e3b05bf9bd64db (diff) | |
parent | 890c0cfe15f0e3325b57e44f9b9a9f78f9797f25 (diff) | |
download | numpy-e1123b2d2cf77d123266604328baa3a27c375cf8.tar.gz |
Merge pull request #20720 from rgommers/arrayapi-annotation-fixes
TYP: add a few type annotations to `numpy.array_api.Array`
Diffstat (limited to 'numpy/array_api/_array_object.py')
-rw-r--r-- | numpy/array_api/_array_object.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/array_api/_array_object.py b/numpy/array_api/_array_object.py index 391e9f575..04d9f8a24 100644 --- a/numpy/array_api/_array_object.py +++ b/numpy/array_api/_array_object.py @@ -56,6 +56,7 @@ class Array: functions, such as asarray(). """ + _array: np.ndarray # Use a custom constructor instead of __init__, as manually initializing # this class is not supported API. @@ -125,7 +126,7 @@ class Array: # spec in places where it either deviates from or is more strict than # NumPy behavior - def _check_allowed_dtypes(self, other, dtype_category, op): + def _check_allowed_dtypes(self, other: bool | int | float | Array, dtype_category: str, op: str) -> Array: """ Helper function for operators to only allow specific input dtypes @@ -201,7 +202,7 @@ class Array: return Array._new(np.array(scalar, self.dtype)) @staticmethod - def _normalize_two_args(x1, x2): + def _normalize_two_args(x1, x2) -> Tuple[Array, Array]: """ Normalize inputs to two arg functions to fix type promotion rules |