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

Function display_script

examples/dis.rs:75–90  ·  view source on GitHub ↗
(
    path: &Path,
    mode: compiler::Mode,
    opts: compiler::CompileOpts,
    expand_code_objects: bool,
)

Source from the content-addressed store, hash-verified

73}
74
75fn display_script(
76 path: &Path,
77 mode: compiler::Mode,
78 opts: compiler::CompileOpts,
79 expand_code_objects: bool,
80) -> Result<(), Box<dyn Error>> {
81 let source = fs::read_to_string(path)?;
82 let code = compiler::compile(&source, mode, &path.to_string_lossy(), opts)?;
83 println!("{}:", path.display());
84 if expand_code_objects {
85 println!("{}", code.display_expand_code_objects());
86 } else {
87 println!("{code}");
88 }
89 Ok(())
90}

Callers 1

mainFunction · 0.85

Calls 2

compileFunction · 0.50
to_string_lossyMethod · 0.45

Tested by

no test coverage detected