Skip to content

Commit 1fd155c

Browse files
committed
index
1 parent 53e1eb5 commit 1fd155c

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/array_api_extra/_lib/_utils/_typing.pyi

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,11 @@ class DType(Protocol): # pylint: disable=missing-class-docstring
9595
class Device(Protocol): # pylint: disable=missing-class-docstring
9696
pass
9797

98-
GetIndex: TypeAlias = ( # type: ignore[no-any-explicit]
99-
int
100-
| slice
101-
| EllipsisType
102-
| Array
103-
| None
104-
| tuple[int | slice | EllipsisType | None | Array, ...]
105-
)
10698
SetIndex: TypeAlias = ( # type: ignore[no-any-explicit]
107-
int
108-
| slice
109-
| EllipsisType
110-
| Array
111-
| tuple[int | slice | EllipsisType | Array, ...]
112-
| GetIndex
99+
int | slice | EllipsisType | Array | tuple[int | slice | EllipsisType | Array, ...]
100+
)
101+
GetIndex: TypeAlias = ( # type: ignore[no-any-explicit]
102+
SetIndex | None | tuple[int | slice | EllipsisType | None | Array, ...]
113103
)
114104

115105
__all__ = ["Array", "DType", "Device", "GetIndex", "SetIndex"]

tests/test_at.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _at_op(
5656
"""jitted helper of at_op"""
5757
if idx_pickle:
5858
idx = pickle.loads(idx_pickle)
59-
meth = cast(Callable[..., Array], getattr(at(x, idx), op.value)) # type: ignore[no-any-explicit]
59+
meth = cast(Callable[..., Array], getattr(at(x, cast(SetIndex, idx)), op.value)) # type: ignore[no-any-explicit]
6060
return meth(y, copy=copy, xp=xp)
6161

6262

0 commit comments

Comments
 (0)