(adict, align)
| 24 | _nbo = '>' |
| 25 | |
| 26 | def _makenames_list(adict, align): |
| 27 | allfields = [] |
| 28 | |
| 29 | for fname, obj in adict.items(): |
| 30 | n = len(obj) |
| 31 | if not isinstance(obj, tuple) or n not in (2, 3): |
| 32 | raise ValueError("entry not a 2- or 3- tuple") |
| 33 | if n > 2 and obj[2] == fname: |
| 34 | continue |
| 35 | num = int(obj[1]) |
| 36 | if num < 0: |
| 37 | raise ValueError("invalid offset.") |
| 38 | format = dtype(obj[0], align=align) |
| 39 | if n > 2: |
| 40 | title = obj[2] |
| 41 | else: |
| 42 | title = None |
| 43 | allfields.append((fname, format, num, title)) |
| 44 | # sort by offsets |
| 45 | allfields.sort(key=lambda x: x[2]) |
| 46 | names = [x[0] for x in allfields] |
| 47 | formats = [x[1] for x in allfields] |
| 48 | offsets = [x[2] for x in allfields] |
| 49 | titles = [x[3] for x in allfields] |
| 50 | |
| 51 | return names, formats, offsets, titles |
| 52 | |
| 53 | # Called in PyArray_DescrConverter function when |
| 54 | # a dictionary without "names" and "formats" |
no test coverage detected