Return the indices values of index in the specified range. If key argument is an integer, the corresponding index is returned. If key is a slice, the range of indices determined by it is returned. A negative value of step in slice is supported, meaning that the resul
(self, key: int | slice)
| 2074 | return (start, stop, step) |
| 2075 | |
| 2076 | def __getitem__(self, key: int | slice) -> int | np.ndarray: |
| 2077 | """Return the indices values of index in the specified range. |
| 2078 | |
| 2079 | If key argument is an integer, the corresponding index is returned. |
| 2080 | If key is a slice, the range of indices determined by it is returned. |
| 2081 | A negative value of step in slice is supported, meaning that the |
| 2082 | results will be returned in reverse order. |
| 2083 | |
| 2084 | This method is equivalent to :meth:`Index.read_indices`. |
| 2085 | |
| 2086 | """ |
| 2087 | if is_idx(key): |
| 2088 | key = operator.index(key) |
| 2089 | |
| 2090 | if key < 0: |
| 2091 | # To support negative values |
| 2092 | key += self.nelements |
| 2093 | return self.read_indices(key, key + 1, 1)[0] |
| 2094 | elif isinstance(key, slice): |
| 2095 | return self.read_indices(key.start, key.stop, key.step) |
| 2096 | |
| 2097 | def __len__(self) -> int: |
| 2098 | return self.nelements |
nothing calls this directly
no test coverage detected