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

Method ast_from_object

crates/vm/src/stdlib/_ast/exception.rs:11–31  ·  view source on GitHub ↗
(
        vm: &VirtualMachine,
        source_file: &SourceFile,
        object: PyObjectRef,
    )

Source from the content-addressed store, hash-verified

9 }
10 }
11 fn ast_from_object(
12 vm: &VirtualMachine,
13 source_file: &SourceFile,
14 object: PyObjectRef,
15 ) -> PyResult<Self> {
16 let cls = object.class();
17 Ok(
18 if cls.is(pyast::NodeExceptHandlerExceptHandler::static_type()) {
19 Self::ExceptHandler(ast::ExceptHandlerExceptHandler::ast_from_object(
20 vm,
21 source_file,
22 object,
23 )?)
24 } else {
25 return Err(vm.new_type_error(format!(
26 "expected some sort of excepthandler, but got {}",
27 object.repr(vm)?
28 )));
29 },
30 )
31 }
32}
33
34// constructor

Callers

nothing calls this directly

Calls 8

ast_from_objectFunction · 0.85
get_node_field_optFunction · 0.85
get_node_fieldFunction · 0.85
range_from_objectFunction · 0.85
isMethod · 0.80
ErrClass · 0.50
classMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected