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

Function format_unpack

crates/vm/src/builtins/memory.rs:1135–1147  ·  view source on GitHub ↗
(
    format_spec: &FormatSpec,
    bytes: &[u8],
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

1133}
1134
1135fn format_unpack(
1136 format_spec: &FormatSpec,
1137 bytes: &[u8],
1138 vm: &VirtualMachine,
1139) -> PyResult<PyObjectRef> {
1140 format_spec.unpack(bytes, vm).map(|x| {
1141 if x.len() == 1 {
1142 x[0].to_owned()
1143 } else {
1144 x.into()
1145 }
1146 })
1147}
1148
1149fn is_equiv_shape(a: &BufferDescriptor, b: &BufferDescriptor) -> bool {
1150 if a.ndim() != b.ndim() {

Callers 3

getitem_by_multi_idxMethod · 0.85
_to_listMethod · 0.85
eqMethod · 0.85

Calls 4

mapMethod · 0.45
unpackMethod · 0.45
lenMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected