Return numpy_array from the tuple returned by rand_structure()
(items, fmt, t)
| 649 | offset=offset, flags=ND_WRITABLE|flags) |
| 650 | |
| 651 | def numpy_array_from_structure(items, fmt, t): |
| 652 | """Return numpy_array from the tuple returned by rand_structure()""" |
| 653 | memlen, itemsize, ndim, shape, strides, offset = t |
| 654 | buf = bytearray(memlen) |
| 655 | for j, v in enumerate(items): |
| 656 | struct.pack_into(fmt, buf, j*itemsize, v) |
| 657 | return numpy_array(buffer=buf, shape=shape, strides=strides, |
| 658 | dtype=fmt, offset=offset) |
| 659 | |
| 660 | |
| 661 | # ====================================================================== |
no test coverage detected
searching dependent graphs…