Expand slice to an array containing only positive integers. Examples -------- >>> _expand_slice(slice(0, 9), 10) array([0, 1, 2, 3, 4, 5, 6, 7, 8]) >>> _expand_slice(slice(0, -1), 10) array([0, 1, 2, 3, 4, 5, 6, 7, 8])
(slice_: slice, size: int)
| 277 | |
| 278 | |
| 279 | def _expand_slice(slice_: slice, size: int) -> np.ndarray[Any, np.dtype[np.integer]]: |
| 280 | """ |
| 281 | Expand slice to an array containing only positive integers. |
| 282 | |
| 283 | Examples |
| 284 | -------- |
| 285 | >>> _expand_slice(slice(0, 9), 10) |
| 286 | array([0, 1, 2, 3, 4, 5, 6, 7, 8]) |
| 287 | >>> _expand_slice(slice(0, -1), 10) |
| 288 | array([0, 1, 2, 3, 4, 5, 6, 7, 8]) |
| 289 | """ |
| 290 | start, stop, step = slice_.indices(size) |
| 291 | return np.arange(start, stop, step) |
| 292 | |
| 293 | |
| 294 | def slice_slice(old_slice: slice, applied_slice: slice, size: int) -> slice: |
no test coverage detected
searching dependent graphs…