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

Function ndarray_print

Lib/test/test_buffer.py:740–756  ·  view source on GitHub ↗

Print ndarray for debugging.

(nd)

Source from the content-addressed store, hash-verified

738 yield tuple(sample(pool, r))
739
740def ndarray_print(nd):
741 """Print ndarray for debugging."""
742 try:
743 x = nd.tolist()
744 except (TypeError, NotImplementedError):
745 x = nd.tobytes()
746 if isinstance(nd, ndarray):
747 offset = nd.offset
748 flags = nd.flags
749 else:
750 offset = 'unknown'
751 flags = 'unknown'
752 print("ndarray(%s, shape=%s, strides=%s, suboffsets=%s, offset=%s, "
753 "format='%s', itemsize=%s, flags=%s)" %
754 (x, nd.shape, nd.strides, nd.suboffsets, offset,
755 nd.format, nd.itemsize, flags))
756 sys.stdout.flush()
757
758
759ITERATIONS = 100

Callers

nothing calls this directly

Calls 5

isinstanceFunction · 0.85
printFunction · 0.50
tolistMethod · 0.45
tobytesMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected