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

Method remove

crates/vm/src/stdlib/_collections.rs:233–246  ·  view source on GitHub ↗
(&self, obj: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

231
232 #[pymethod]
233 fn remove(&self, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult {
234 let start_state = self.state.load();
235 let index = self.mut_index(vm, &obj)?;
236
237 if start_state != self.state.load() {
238 Err(vm.new_index_error("deque mutated during remove()."))
239 } else if let Some(index) = index.into() {
240 let mut deque = self.borrow_deque_mut();
241 self.state.fetch_add(1);
242 Ok(deque.remove(index).unwrap())
243 } else {
244 Err(vm.new_value_error("deque.remove(x): x not in deque"))
245 }
246 }
247
248 #[pymethod]
249 fn reverse(&self) {

Callers 12

take_docstringFunction · 0.45
initMethod · 0.45
__delitem__Method · 0.45
unregisterFunction · 0.45
dropMethod · 0.45
register_callbackFunction · 0.45
set_local_eventsFunction · 0.45
fireFunction · 0.45
extend_classMethod · 0.45
ast_replaceFunction · 0.45
drop_libMethod · 0.45

Calls 5

mut_indexMethod · 0.80
borrow_deque_mutMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected