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

Function gencastshapes

Lib/test/test_buffer.py:698–707  ·  view source on GitHub ↗

Generate shapes to test casting.

()

Source from the content-addressed store, hash-verified

696 return (items, shape) if shape != [] else (items[0], shape)
697
698def gencastshapes():
699 """Generate shapes to test casting."""
700 for n in range(32):
701 yield [n]
702 ndim = randrange(4, 6)
703 minshape = 1 if randrange(100) > 80 else 2
704 yield [randrange(minshape, 5) for _ in range(ndim)]
705 ndim = randrange(2, 4)
706 minshape = 1 if randrange(100) > 80 else 2
707 yield [randrange(minshape, 5) for _ in range(ndim)]
708
709
710# ======================================================================

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…