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

Function check_valid_tool

crates/vm/src/stdlib/sys/monitoring.rs:167–172  ·  view source on GitHub ↗
(tool_id: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

165}
166
167fn check_valid_tool(tool_id: i32, vm: &VirtualMachine) -> PyResult<usize> {
168 if !(0..TOOL_LIMIT as i32).contains(&tool_id) {
169 return Err(vm.new_value_error(format!("invalid tool {tool_id} (must be between 0 and 5)")));
170 }
171 Ok(tool_id as usize)
172}
173
174fn check_tool_in_use(tool: usize, vm: &VirtualMachine) -> PyResult<()> {
175 let state = vm.state.monitoring.lock();

Callers 9

use_tool_idFunction · 0.85
clear_tool_idFunction · 0.85
free_tool_idFunction · 0.85
get_toolFunction · 0.85
register_callbackFunction · 0.85
get_eventsFunction · 0.85
set_eventsFunction · 0.85
get_local_eventsFunction · 0.85
set_local_eventsFunction · 0.85

Calls 2

ErrClass · 0.50
containsMethod · 0.45

Tested by

no test coverage detected