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

Function rslices_ndim

Lib/test/test_buffer.py:736–745  ·  view source on GitHub ↗

Generate random slice tuples for 'shape'.

(ndim, shape, iterations=5)

Source from the content-addressed store, hash-verified

734 yield rslice(n, allow_empty)
735
736def rslices_ndim(ndim, shape, iterations=5):
737 """Generate random slice tuples for 'shape'."""
738 # non-empty slices
739 for _ in range(iterations):
740 yield tuple(rslice(shape[n]) for n in range(ndim))
741 # possibly empty slices
742 for _ in range(iterations):
743 yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim))
744 # invalid slices
745 yield tuple(slice(0,1,0) for _ in range(ndim))
746
747def rpermutation(iterable, r=None):
748 pool = tuple(iterable)

Calls 2

rsliceFunction · 0.85
sliceClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…