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

Function struct_items

Lib/test/test_buffer.py:209–221  ·  view source on GitHub ↗
(n, obj)

Source from the content-addressed store, hash-verified

207 return lst
208
209def struct_items(n, obj):
210 mode = choice(cap[obj][MODE])
211 xfmt = mode + '#'
212 fmt = mode.strip('amb')
213 nmemb = randrange(2, 10) # number of struct members
214 for _ in range(nmemb):
215 char = choice(tuple(fmtdict[mode]))
216 multiplier = choice(cap[obj][MULT])
217 xfmt += (char * int(multiplier if multiplier else 1))
218 fmt += (multiplier + char)
219 items = gen_items(n, xfmt, obj)
220 item = gen_item(xfmt, obj)
221 return fmt, items, item
222
223def randitems(n, obj='ndarray', mode=None, char=None):
224 """Return random format, items, item."""

Callers 1

iter_formatFunction · 0.85

Calls 4

choiceFunction · 0.85
gen_itemsFunction · 0.85
gen_itemFunction · 0.85
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…