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

Function struct_items

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

Source from the content-addressed store, hash-verified

195 return lst
196
197def struct_items(n, obj):
198 mode = choice(cap[obj][MODE])
199 xfmt = mode + '#'
200 fmt = mode.strip('amb')
201 nmemb = randrange(2, 10) # number of struct members
202 for _ in range(nmemb):
203 char = choice(tuple(fmtdict[mode]))
204 multiplier = choice(cap[obj][MULT])
205 xfmt += (char * int(multiplier if multiplier else 1))
206 fmt += (multiplier + char)
207 items = gen_items(n, xfmt, obj)
208 item = gen_item(xfmt, obj)
209 return fmt, items, item
210
211def randitems(n, obj='ndarray', mode=None, char=None):
212 """Return random format, items, item."""

Callers 1

iter_formatFunction · 0.85

Calls 3

gen_itemsFunction · 0.85
gen_itemFunction · 0.85
stripMethod · 0.45

Tested by

no test coverage detected