MCPcopy Index your code
hub / github.com/python/mypy / vec_create_from_values

Function vec_create_from_values

mypyc/irbuild/vec.py:178–194  ·  view source on GitHub ↗
(
    builder: LowLevelIRBuilder,
    vtype: RVec,
    values: list[Value],
    line: int,
    *,
    capacity: Value | None = None,
)

Source from the content-addressed store, hash-verified

176
177
178def vec_create_from_values(
179 builder: LowLevelIRBuilder,
180 vtype: RVec,
181 values: list[Value],
182 line: int,
183 *,
184 capacity: Value | None = None,
185) -> Value:
186 vec = vec_create(builder, vtype, len(values), line, capacity=capacity)
187 ptr = vec_items(builder, vec)
188 item_type = vtype.item_type
189 step = step_size(item_type)
190 for value in values:
191 vec_set_mem_item(builder, ptr, item_type, value)
192 ptr = builder.int_add(ptr, step)
193 builder.keep_alive([vec], line)
194 return vec
195
196
197def step_size(item_type: RType) -> int:

Callers 1

Calls 7

vec_createFunction · 0.85
lenFunction · 0.85
vec_itemsFunction · 0.85
step_sizeFunction · 0.85
vec_set_mem_itemFunction · 0.85
int_addMethod · 0.80
keep_aliveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…