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

Function get_node_field

crates/vm/src/stdlib/_ast.rs:71–74  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &PyObject, field: &'static str, typ: &str)

Source from the content-addressed store, hash-verified

69}
70
71fn get_node_field(vm: &VirtualMachine, obj: &PyObject, field: &'static str, typ: &str) -> PyResult {
72 vm.get_attribute_opt(obj.to_owned(), field)?
73 .ok_or_else(|| vm.new_type_error(format!(r#"required field "{field}" missing from {typ}"#)))
74}
75
76fn get_node_field_opt(
77 vm: &VirtualMachine,

Callers 14

get_int_fieldFunction · 0.85
wrap_interactiveFunction · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectFunction · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85
ast_from_objectMethod · 0.85

Calls 3

ok_or_elseMethod · 0.80
get_attribute_optMethod · 0.80
to_ownedMethod · 0.45

Tested by

no test coverage detected