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

Function _fa

Lib/test/test_buffer.py:313–324  ·  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

311 return lst
312
313def _fa(items, s):
314 """Convert flat item list to the nested list representation of a
315 multidimensional Fortran array with shape 's'."""
316 if atomp(items):
317 return items
318 if len(s) == 0:
319 return items[0]
320 lst = [0] * s[0]
321 stride = s[0]
322 for i in range(s[0]):
323 lst[i] = _fa(items[i::stride], s[1:])
324 return lst
325
326def carray(items, shape):
327 if listp(items) and not 0 in shape and prod(shape) != len(items):

Callers 1

farrayFunction · 0.85

Calls 1

atompFunction · 0.85

Tested by

no test coverage detected