| 164 | |
| 165 | |
| 166 | def _validate_indexer(chunks, indexer, axis): |
| 167 | if not isinstance(indexer, list) or not all(isinstance(i, list) for i in indexer): |
| 168 | raise ValueError("indexer must be a list of lists of positional indices") |
| 169 | |
| 170 | if not axis <= len(chunks): |
| 171 | raise ValueError( |
| 172 | f"Axis {axis} is out of bounds for array with {len(chunks)} axes" |
| 173 | ) |
| 174 | |
| 175 | if max(map(max, indexer)) >= sum(chunks[axis]): |
| 176 | raise IndexError( |
| 177 | f"Indexer contains out of bounds index. Dimension only has {sum(chunks[axis])} elements." |
| 178 | ) |
| 179 | |
| 180 | |
| 181 | def _shuffle(chunks, indexer, axis, in_name, out_name, token): |