Support explicit indexing by delegating to a raw indexing method. Outer and/or vectorized indexers are supported by indexing a second time with a NumPy array. Parameters ---------- key : ExplicitIndexer Explicit indexing object. shape : Tuple[int, ...] Shape
(
key: ExplicitIndexer,
shape: _Shape,
indexing_support: IndexingSupport,
raw_indexing_method: Callable[..., Any],
)
| 1126 | |
| 1127 | |
| 1128 | def explicit_indexing_adapter( |
| 1129 | key: ExplicitIndexer, |
| 1130 | shape: _Shape, |
| 1131 | indexing_support: IndexingSupport, |
| 1132 | raw_indexing_method: Callable[..., Any], |
| 1133 | ) -> Any: |
| 1134 | """Support explicit indexing by delegating to a raw indexing method. |
| 1135 | |
| 1136 | Outer and/or vectorized indexers are supported by indexing a second time |
| 1137 | with a NumPy array. |
| 1138 | |
| 1139 | Parameters |
| 1140 | ---------- |
| 1141 | key : ExplicitIndexer |
| 1142 | Explicit indexing object. |
| 1143 | shape : Tuple[int, ...] |
| 1144 | Shape of the indexed array. |
| 1145 | indexing_support : IndexingSupport enum |
| 1146 | Form of indexing supported by raw_indexing_method. |
| 1147 | raw_indexing_method : callable |
| 1148 | Function (like ndarray.__getitem__) that when called with indexing key |
| 1149 | in the form of a tuple returns an indexed array. |
| 1150 | |
| 1151 | Returns |
| 1152 | ------- |
| 1153 | Indexing result, in the form of a duck numpy-array. |
| 1154 | """ |
| 1155 | raw_key, numpy_indices = decompose_indexer(key, shape, indexing_support) |
| 1156 | result = raw_indexing_method(raw_key.tuple) |
| 1157 | if numpy_indices.tuple: |
| 1158 | # index the loaded duck array |
| 1159 | indexable = as_indexable(result) |
| 1160 | result = apply_indexer(indexable, numpy_indices) |
| 1161 | return result |
| 1162 | |
| 1163 | |
| 1164 | async def async_explicit_indexing_adapter( |
nothing calls this directly
no test coverage detected
searching dependent graphs…