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

Function randitems

Lib/test/test_buffer.py:223–234  ·  view source on GitHub ↗

Return random format, items, item.

(n, obj='ndarray', mode=None, char=None)

Source from the content-addressed store, hash-verified

221 return fmt, items, item
222
223def randitems(n, obj='ndarray', mode=None, char=None):
224 """Return random format, items, item."""
225 if mode is None:
226 mode = choice(cap[obj][MODE])
227 if char is None:
228 char = choice(tuple(fmtdict[mode]))
229 multiplier = choice(cap[obj][MULT])
230 fmt = mode + '#' + char * int(multiplier if multiplier else 1)
231 items = gen_items(n, fmt, obj)
232 item = gen_item(fmt, obj)
233 fmt = mode.strip('amb') + multiplier + char
234 return fmt, items, item
235
236def iter_mode(n, obj='ndarray'):
237 """Iterate through supported mode/char combinations."""

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…