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

Function clear_tool_id

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

Source from the content-addressed store, hash-verified

548}
549
550fn clear_tool_id(tool_id: i32, vm: &VirtualMachine) -> PyResult<()> {
551 let tool = check_valid_tool(tool_id, vm)?;
552 let mut state = vm.state.monitoring.lock();
553 if state.tool_names[tool].is_some() {
554 state.global_events[tool] = 0;
555 state
556 .local_events
557 .retain(|(local_tool, _), _| *local_tool != tool);
558 state.callbacks.retain(|(cb_tool, _), _| *cb_tool != tool);
559 state.disabled.retain(|&(_, _, t)| t != tool);
560 }
561 update_events_mask(vm, &state);
562 Ok(())
563}
564
565fn free_tool_id(tool_id: i32, vm: &VirtualMachine) -> PyResult<()> {
566 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