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

Function wrap_interactive

crates/vm/src/stdlib/_ast.rs:399–410  ·  view source on GitHub ↗
(vm: &VirtualMachine, module_obj: PyObjectRef)

Source from the content-addressed store, hash-verified

397
398#[cfg(feature = "parser")]
399pub(crate) fn wrap_interactive(vm: &VirtualMachine, module_obj: PyObjectRef) -> PyResult {
400 if !module_obj.class().is(pyast::NodeModModule::static_type()) {
401 return Err(vm.new_type_error("expected Module node"));
402 }
403 let body = get_node_field(vm, &module_obj, "body", "Module")?;
404 let node = NodeAst
405 .into_ref_with_type(vm, pyast::NodeModInteractive::static_type().to_owned())
406 .unwrap();
407 let dict = node.as_object().dict().unwrap();
408 dict.set_item("body", body, vm).unwrap();
409 Ok(node.into())
410}
411
412#[cfg(feature = "parser")]
413pub(crate) fn parse_func_type(

Callers 1

compileFunction · 0.85

Calls 10

get_node_fieldFunction · 0.85
isMethod · 0.80
into_ref_with_typeMethod · 0.80
ErrClass · 0.50
classMethod · 0.45
unwrapMethod · 0.45
to_ownedMethod · 0.45
dictMethod · 0.45
as_objectMethod · 0.45
set_itemMethod · 0.45

Tested by

no test coverage detected