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

Function gen_item

Lib/test/test_buffer.py:192–198  ·  view source on GitHub ↗

Return single random item.

(fmt, obj)

Source from the content-addressed store, hash-verified

190 return x
191
192def gen_item(fmt, obj):
193 """Return single random item."""
194 mode, chars = fmt.split('#')
195 x = []
196 for c in chars:
197 x.append(randrange_fmt(mode, c, obj))
198 return x[0] if len(x) == 1 else tuple(x)
199
200def gen_items(n, fmt, obj):
201 """Return a list of random items (or a scalar)."""

Callers 3

gen_itemsFunction · 0.85
struct_itemsFunction · 0.85
randitemsFunction · 0.85

Calls 3

randrange_fmtFunction · 0.85
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…