Skip to content

Commit 1540ff8

Browse files
committed
Add type hints to the numpy.array_api.Array.__array__ signature
Thanks @BvB93 Original NumPy Commit: 5f21063cc317d92a866c7259a9509f5e5d6189c2
1 parent 93bf311 commit 1540ff8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

array_api_strict/_array_object.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
if TYPE_CHECKING:
3535
from ._typing import Any, PyCapsule, Device, Dtype
36+
import numpy.typing as npt
3637

3738
import numpy as np
3839

@@ -110,7 +111,7 @@ def __repr__(self: Array, /) -> str:
110111

111112
# This function is not required by the spec, but we implement it here for
112113
# convenience so that np.asarray(np.array_api.Array) will work.
113-
def __array__(self, dtype=None):
114+
def __array__(self, dtype: None | np.dtype[Any] = None) -> npt.NDArray[Any]:
114115
"""
115116
Warning: this method is NOT part of the array API spec. Implementers
116117
of other libraries need not include it, and users should not assume it

0 commit comments

Comments
 (0)