MCPcopy Create free account
hub / github.com/numpy/numpy / _usefields

Function _usefields

numpy/core/_internal.py:56–79  ·  view source on GitHub ↗
(adict, align)

Source from the content-addressed store, hash-verified

54# a dictionary without "names" and "formats"
55# fields is used as a data-type descriptor.
56def _usefields(adict, align):
57 try:
58 names = adict[-1]
59 except KeyError:
60 names = None
61 if names is None:
62 names, formats, offsets, titles = _makenames_list(adict, align)
63 else:
64 formats = []
65 offsets = []
66 titles = []
67 for name in names:
68 res = adict[name]
69 formats.append(res[0])
70 offsets.append(res[1])
71 if len(res) > 2:
72 titles.append(res[2])
73 else:
74 titles.append(None)
75
76 return dtype({"names": names,
77 "formats": formats,
78 "offsets": offsets,
79 "titles": titles}, align)
80
81
82# construct an array_protocol descriptor list

Callers

nothing calls this directly

Calls 2

_makenames_listFunction · 0.85
dtypeFunction · 0.85

Tested by

no test coverage detected