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

Function free_tool_id

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

Source from the content-addressed store, hash-verified

563}
564
565fn free_tool_id(tool_id: i32, vm: &VirtualMachine) -> PyResult<()> {
566 let tool = check_valid_tool(tool_id, vm)?;
567 let mut state = vm.state.monitoring.lock();
568 if state.tool_names[tool].is_some() {
569 state.global_events[tool] = 0;
570 state
571 .local_events
572 .retain(|(local_tool, _), _| *local_tool != tool);
573 state.callbacks.retain(|(cb_tool, _), _| *cb_tool != tool);
574 state.disabled.retain(|&(_, _, t)| t != tool);
575 state.tool_names[tool] = None;
576 }
577 update_events_mask(vm, &state);
578 Ok(())
579}
580
581fn get_tool(tool_id: i32, vm: &VirtualMachine) -> PyResult<Option<String>> {
582 let tool = check_valid_tool(tool_id, vm)?;

Callers

nothing calls this directly

Calls 4

check_valid_toolFunction · 0.85
update_events_maskFunction · 0.85
lockMethod · 0.45
retainMethod · 0.45

Tested by

no test coverage detected