Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: data-apis/array-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: data-apis/array-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: supports-index-typing
Choose a head ref
  • 4 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 21, 2024

  1. Copy the full SHA
    3c9c047 View commit details

Commits on Mar 22, 2024

  1. Copy the full SHA
    18910c0 View commit details
  2. Add space before __setitem__() note in docstring

    Might fix rendering/warning issue
    honno committed Mar 22, 2024
    Copy the full SHA
    ef9c4c1 View commit details

Commits on Mar 27, 2024

  1. Copy the full SHA
    986ba27 View commit details
Showing with 18 additions and 4 deletions.
  1. +18 −4 src/array_api_stubs/_draft/array_object.py
22 changes: 18 additions & 4 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

__all__ = ["array"]

from typing import SupportsIndex
from ._types import (
array,
dtype as Dtype,
@@ -608,7 +609,8 @@ def __getitem__(
slice,
ellipsis,
None,
Tuple[Union[int, slice, ellipsis, None], ...],
SupportsIndex,
Tuple[Union[int, slice, ellipsis, None, SupportsIndex], ...],
array,
],
/,
@@ -620,9 +622,13 @@ def __getitem__(
----------
self: array
array instance.
key: Union[int, slice, ellipsis, None, Tuple[Union[int, slice, ellipsis, None], ...], array]
key: Union[int, slice, ellipsis, None, SupportsIndex, Tuple[Union[int, slice, ellipsis, None, SupportsIndex], ...], array]
index key.
.. note::
``key`` can only be an array if it is valid for boolean array indexing, or when it supports ``__index__()`` as a 0-dimensional integer array.
Returns
-------
out: array
@@ -1077,7 +1083,12 @@ def __rshift__(self: array, other: Union[int, array], /) -> array:
def __setitem__(
self: array,
key: Union[
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array
int,
slice,
ellipsis,
SupportsIndex,
Tuple[Union[int, slice, ellipsis, SupportsIndex], ...],
array,
],
value: Union[int, float, bool, array],
/,
@@ -1089,12 +1100,15 @@ def __setitem__(
----------
self: array
array instance.
key: Union[int, slice, ellipsis, Tuple[Union[int, 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`).
.. note::
``key`` can only be an array if it is valid for boolean array indexing, or when it supports ``__index__()`` as a 0-dimensional integer array.
.. note::
Setting array values must not affect the data type of ``self``.