MCPcopy Index your code
hub / github.com/RustPython/RustPython / rslices_ndim

Function rslices_ndim

Lib/test/test_buffer.py:724–733  ·  view source on GitHub ↗

Generate random slice tuples for 'shape'.

(ndim, shape, iterations=5)

Source from the content-addressed store, hash-verified

722 yield rslice(n, allow_empty)
723
724def rslices_ndim(ndim, shape, iterations=5):
725 """Generate random slice tuples for 'shape'."""
726 # non-empty slices
727 for _ in range(iterations):
728 yield tuple(rslice(shape[n]) for n in range(ndim))
729 # possibly empty slices
730 for _ in range(iterations):
731 yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim))
732 # invalid slices
733 yield tuple(slice(0,1,0) for _ in range(ndim))
734
735def rpermutation(iterable, r=None):
736 pool = tuple(iterable)

Calls 2

rsliceFunction · 0.85
sliceClass · 0.85

Tested by

no test coverage detected