Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add int alongside SupportIndex in indexing type hints
  • Loading branch information
honno committed Mar 22, 2024
commit 18910c077ff549d9dad9004ab75619b89bde00c3
14 changes: 8 additions & 6 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,12 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array:
def __getitem__(
self: array,
key: Union[
SupportsIndex,
int,
slice,
ellipsis,
None,
Tuple[Union[SupportsIndex, slice, ellipsis, None], ...],
SupportsIndex,
Tuple[Union[int, slice, ellipsis, None, SupportsIndex], ...],
array,
],
/,
Expand All @@ -621,7 +622,7 @@ def __getitem__(
----------
self: array
array instance.
key: Union[SupportsIndex, slice, ellipsis, None, Tuple[Union[SupportsIndex, slice, ellipsis, None], ...], array]
key: Union[int, slice, ellipsis, None, SupportsIndex, Tuple[Union[int, slice, ellipsis, None, SupportsIndex], ...], array]
index key.


Expand Down Expand Up @@ -1082,10 +1083,11 @@ def __rshift__(self: array, other: Union[int, array], /) -> array:
def __setitem__(
self: array,
key: Union[
SupportsIndex,
int,
slice,
ellipsis,
Tuple[Union[SupportsIndex, slice, ellipsis], ...],
SupportsIndex,
Tuple[Union[int, slice, ellipsis, SupportsIndex], ...],
array,
],
value: Union[int, float, bool, array],
Expand All @@ -1098,7 +1100,7 @@ def __setitem__(
----------
self: array
array instance.
key: Union[SupportsIndex, slice, ellipsis, Tuple[Union[SupportsIndex, slice, ellipsis], ...], array]
key: Union[int, slice, ellipsis, SupportsIndex, Tuple[Union[int, slice, ellipsis, SupportsIndex], ...], array]
index key.
value: Union[int, float, bool, array]
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
Expand Down