Tuple for basic indexing. All elements should be int or slice objects. Indexing follows NumPy's rules for basic indexing: each axis is independently sliced and axes indexed with an integer are dropped from the result.
| 475 | |
| 476 | |
| 477 | class BasicIndexer(ExplicitIndexer): |
| 478 | """Tuple for basic indexing. |
| 479 | |
| 480 | All elements should be int or slice objects. Indexing follows NumPy's |
| 481 | rules for basic indexing: each axis is independently sliced and axes |
| 482 | indexed with an integer are dropped from the result. |
| 483 | """ |
| 484 | |
| 485 | __slots__ = () |
| 486 | |
| 487 | def __init__(self, key: tuple[BasicIndexerType, ...]): |
| 488 | if not isinstance(key, tuple): |
| 489 | raise TypeError(f"key must be a tuple: {key!r}") |
| 490 | |
| 491 | new_key = [] |
| 492 | for k in key: |
| 493 | if isinstance(k, integer_types): |
| 494 | k = int(k) |
| 495 | elif isinstance(k, slice): |
| 496 | k = as_integer_slice(k) |
| 497 | else: |
| 498 | raise TypeError( |
| 499 | f"unexpected indexer type for {type(self).__name__}: {k!r}" |
| 500 | ) |
| 501 | new_key.append(k) |
| 502 | |
| 503 | super().__init__(tuple(new_key)) |
| 504 | |
| 505 | |
| 506 | class OuterIndexer(ExplicitIndexer): |
no outgoing calls
no test coverage detected
searching dependent graphs…