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

Function run

example_projects/frozen_stdlib/src/main.rs:10–18  ·  view source on GitHub ↗
(keyword: &str, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

8use rustpython_vm::{PyResult, VirtualMachine};
9
10fn run(keyword: &str, vm: &VirtualMachine) -> PyResult<()> {
11 let json = vm.import("json", 0)?;
12 let json_loads = json.get_attr("loads", vm)?;
13 let template = r#"{"key": "value"}"#;
14 let json_string = template.replace("value", keyword);
15 let dict = json_loads.call((vm.ctx.new_str(json_string),), vm)?;
16 vm.print((dict,))?;
17 Ok(())
18}
19
20fn interpreter_with_config() {
21 let interpreter = rustpython::InterpreterBuilder::new()

Callers 2

interpreter_with_configFunction · 0.70
interpreter_with_vmFunction · 0.70

Calls 6

importMethod · 0.45
get_attrMethod · 0.45
replaceMethod · 0.45
callMethod · 0.45
new_strMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected