Skip to content

Commit f6015d2

Browse files
committed
Update a function signature from the array API spec
1 parent be1ee6c commit f6015d2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

numpy/_array_api/_array_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from typing import TYPE_CHECKING
2424
if TYPE_CHECKING:
25-
from ._types import Optional, PyCapsule, Tuple, Union, array
25+
from ._types import Any, Optional, PyCapsule, Tuple, Union, array
2626

2727
import numpy as np
2828

@@ -186,7 +186,7 @@ def __bool__(self: array, /) -> bool:
186186
res = self._array.__bool__()
187187
return res
188188

189-
def __dlpack__(self: array, /, *, stream: Optional[int] = None) -> PyCapsule:
189+
def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> PyCapsule:
190190
"""
191191
Performs the operation __dlpack__.
192192
"""

numpy/_array_api/_types.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
valid for inputs that match the given type annotations.
77
"""
88

9-
__all__ = ['List', 'Literal', 'Optional', 'Tuple', 'Union', 'array', 'device',
10-
'dtype', 'SupportsDLPack', 'SupportsBufferProtocol', 'PyCapsule']
9+
__all__ = ['Any', 'List', 'Literal', 'Optional', 'Tuple', 'Union', 'array',
10+
'device', 'dtype', 'SupportsDLPack', 'SupportsBufferProtocol',
11+
'PyCapsule']
1112

12-
from typing import List, Literal, Optional, Tuple, Union, TypeVar
13+
from typing import Any, List, Literal, Optional, Tuple, Union, TypeVar
1314

1415
from . import (ndarray, int8, int16, int32, int64, uint8, uint16, uint32,
1516
uint64, float32, float64)

0 commit comments

Comments
 (0)