| 15 | |
| 16 | |
| 17 | def _validate_indexer(chunks, indexer, axis): |
| 18 | if not isinstance(indexer, list) or not all(isinstance(i, list) for i in indexer): |
| 19 | raise ValueError("indexer must be a list of lists of positional indices") |
| 20 | |
| 21 | if not axis <= len(chunks): |
| 22 | raise ValueError( |
| 23 | f"Axis {axis} is out of bounds for array with {len(chunks)} axes" |
| 24 | ) |
| 25 | |
| 26 | if max(map(max, indexer)) >= sum(chunks[axis]): |
| 27 | raise IndexError( |
| 28 | f"Indexer contains out of bounds index. Dimension only has {sum(chunks[axis])} elements." |
| 29 | ) |
| 30 | |
| 31 | |
| 32 | def _shuffle(x, indexer, axis, name): |