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

Function _fa

Lib/test/test_buffer.py:301–312  ·  view source on GitHub ↗

Convert flat item list to the nested list representation of a multidimensional Fortran array with shape 's'.

(items, s)

Source from the content-addressed store, hash-verified

299 return lst
300
301def _fa(items, s):
302 """Convert flat item list to the nested list representation of a
303 multidimensional Fortran array with shape 's'."""
304 if atomp(items):
305 return items
306 if len(s) == 0:
307 return items[0]
308 lst = [0] * s[0]
309 stride = s[0]
310 for i in range(s[0]):
311 lst[i] = _fa(items[i::stride], s[1:])
312 return lst
313
314def carray(items, shape):
315 if listp(items) and not 0 in shape and prod(shape) != len(items):

Callers 1

farrayFunction · 0.85

Calls 2

atompFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected