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

Function bytes_literal_to_object

crates/vm/src/stdlib/_ast/constant.rs:394–407  ·  view source on GitHub ↗
(
    vm: &VirtualMachine,
    source_file: &SourceFile,
    constant: ast::ExprBytesLiteral,
)

Source from the content-addressed store, hash-verified

392}
393
394pub(super) fn bytes_literal_to_object(
395 vm: &VirtualMachine,
396 source_file: &SourceFile,
397 constant: ast::ExprBytesLiteral,
398) -> PyObjectRef {
399 let ast::ExprBytesLiteral {
400 node_index: _,
401 range,
402 value,
403 } = constant;
404 let bytes = value.as_slice().iter().flat_map(|b| b.value.iter());
405 let c = Constant::new_bytes(bytes.copied().collect(), range);
406 c.ast_to_object(vm, source_file)
407}
408
409pub(super) fn boolean_literal_to_object(
410 vm: &VirtualMachine,

Callers 1

ast_to_objectMethod · 0.85

Calls 4

collectMethod · 0.80
iterMethod · 0.45
as_sliceMethod · 0.45
ast_to_objectMethod · 0.45

Tested by

no test coverage detected