MCPcopy Index your code
hub / github.com/pydata/xarray / _expand_slice

Function _expand_slice

xarray/core/indexing.py:279–291  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

277
278
279def _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
294def slice_slice(old_slice: slice, applied_slice: slice, size: int) -> slice:

Callers 1

_arrayize_outer_indexerFunction · 0.85

Calls 1

arangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…