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

Function gen_items

Lib/test/test_buffer.py:188–195  ·  view source on GitHub ↗

Return a list of random items (or a scalar).

(n, fmt, obj)

Source from the content-addressed store, hash-verified

186 return x[0] if len(x) == 1 else tuple(x)
187
188def gen_items(n, fmt, obj):
189 """Return a list of random items (or a scalar)."""
190 if n == 0:
191 return gen_item(fmt, obj)
192 lst = [0] * n
193 for i in range(n):
194 lst[i] = gen_item(fmt, obj)
195 return lst
196
197def struct_items(n, obj):
198 mode = choice(cap[obj][MODE])

Callers 3

struct_itemsFunction · 0.85
randitemsFunction · 0.85
randitems_from_structureFunction · 0.85

Calls 1

gen_itemFunction · 0.85

Tested by

no test coverage detected