MCPcopy Index your code
hub / github.com/python/cpython / genslices_ndim

Function genslices_ndim

Lib/test/test_buffer.py:718–721  ·  view source on GitHub ↗

Generate all possible slice tuples for 'shape'.

(ndim, shape)

Source from the content-addressed store, hash-verified

716 return product(range(-n, n+1), range(-n, n+1), range(-n, n+1))
717
718def genslices_ndim(ndim, shape):
719 """Generate all possible slice tuples for 'shape'."""
720 iterables = [genslices(shape[n]) for n in range(ndim)]
721 return product(*iterables)
722
723def rslice(n, allow_empty=False):
724 """Generate random slice for a single dimension of length n.

Callers

nothing calls this directly

Calls 1

genslicesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…