-
Notifications
You must be signed in to change notification settings - Fork 53
Replace int
with SupportsIndex
in indexing methods hints
#766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
3c9c047
18910c0
ef9c4c1
986ba27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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, | ||
|
@@ -604,11 +605,11 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array: | |
def __getitem__( | ||
self: array, | ||
key: Union[ | ||
int, | ||
SupportsIndex, | ||
slice, | ||
ellipsis, | ||
None, | ||
Tuple[Union[int, slice, ellipsis, None], ...], | ||
Tuple[Union[SupportsIndex, slice, ellipsis, None], ...], | ||
array, | ||
], | ||
/, | ||
|
@@ -620,9 +621,13 @@ def __getitem__( | |
---------- | ||
self: array | ||
array instance. | ||
key: Union[int, slice, ellipsis, None, Tuple[Union[int, slice, ellipsis, None], ...], array] | ||
key: Union[SupportsIndex, slice, ellipsis, None, Tuple[Union[SupportsIndex, slice, ellipsis, None], ...], array] | ||
index key. | ||
|
||
|
||
.. note:: | ||
``key`` can only be an array if it is valid for boolean array indexing, or supports ``__index__()``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably somewhere else we say it should support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep that'd help, let me know on the wording from my latest commit. |
||
|
||
Returns | ||
------- | ||
out: array | ||
|
@@ -1077,7 +1082,11 @@ def __rshift__(self: array, other: Union[int, array], /) -> array: | |
def __setitem__( | ||
self: array, | ||
key: Union[ | ||
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array | ||
SupportsIndex, | ||
slice, | ||
ellipsis, | ||
Tuple[Union[SupportsIndex, slice, ellipsis], ...], | ||
array, | ||
], | ||
value: Union[int, float, bool, array], | ||
/, | ||
|
@@ -1089,11 +1098,13 @@ def __setitem__( | |
---------- | ||
self: array | ||
array instance. | ||
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array] | ||
key: Union[SupportsIndex, slice, ellipsis, Tuple[Union[SupportsIndex, slice, ellipsis], ...], 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 supports ``__index__()``. | ||
honno marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. note:: | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.