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

Function vec_slice

mypyc/irbuild/vec.py:572–596  ·  view source on GitHub ↗
(
    builder: LowLevelIRBuilder, vec: Value, begin: Value, end: Value, line: int
)

Source from the content-addressed store, hash-verified

570
571
572def vec_slice(
573 builder: LowLevelIRBuilder, vec: Value, begin: Value, end: Value, line: int
574) -> Value:
575 assert isinstance(vec.type, RVec)
576 vec_type = vec.type
577 item_type = vec_type.item_type
578 begin = builder.coerce(begin, int64_rprimitive, line)
579 end = builder.coerce(end, int64_rprimitive, line)
580 api_name = vec_api_by_item_type.get(item_type)
581 if api_name is not None:
582 name = f"{api_name}.slice"
583 elif vec_type.depth() == 0:
584 name = "VecTApi.slice"
585 else:
586 name = "VecNestedApi.slice"
587 call = CallC(
588 name,
589 [vec, begin, end],
590 vec_type,
591 steals=[False, False, False],
592 is_borrowed=False,
593 error_kind=ERR_MAGIC,
594 line=line,
595 )
596 return builder.add(call)
597
598
599def vec_to_list(builder: LowLevelIRBuilder, vec: Value, line: int) -> Value | None:

Callers 1

try_gen_slice_opFunction · 0.90

Calls 6

CallCClass · 0.90
isinstanceFunction · 0.85
depthMethod · 0.80
coerceMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…