summaryrefslogtreecommitdiff
path: root/numpy/array_api/_array_object.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-12-06 17:19:55 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-12-06 17:19:55 -0700
commit5f21063cc317d92a866c7259a9509f5e5d6189c2 (patch)
treeb4664d6e82ece902843a7b3862be12b127a2e906 /numpy/array_api/_array_object.py
parent74a3ee7a8b75bf6dc271c9a1a4b55d2ad9758420 (diff)
downloadnumpy-5f21063cc317d92a866c7259a9509f5e5d6189c2.tar.gz
Add type hints to the numpy.array_api.Array.__array__ signature
Thanks @BvB93
Diffstat (limited to 'numpy/array_api/_array_object.py')
-rw-r--r--numpy/array_api/_array_object.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/array_api/_array_object.py b/numpy/array_api/_array_object.py
index d322e6ca6..75baf34b0 100644
--- a/numpy/array_api/_array_object.py
+++ b/numpy/array_api/_array_object.py
@@ -33,6 +33,7 @@ from typing import TYPE_CHECKING, Optional, Tuple, Union, Any
if TYPE_CHECKING:
from ._typing import Any, PyCapsule, Device, Dtype
+ import numpy.typing as npt
import numpy as np
@@ -110,7 +111,7 @@ class Array:
# This function is not required by the spec, but we implement it here for
# convenience so that np.asarray(np.array_api.Array) will work.
- def __array__(self, dtype=None):
+ def __array__(self, dtype: None | np.dtype[Any] = None) -> npt.NDArray[Any]:
"""
Warning: this method is NOT part of the array API spec. Implementers
of other libraries need not include it, and users should not assume it