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

Method unregister

crates/vm/src/codecs.rs:217–233  ·  view source on GitHub ↗
(&self, search_function: PyObjectRef)

Source from the content-addressed store, hash-verified

215 }
216
217 pub fn unregister(&self, search_function: PyObjectRef) -> PyResult<()> {
218 let mut inner = self.inner.write();
219 // Do nothing if search_path is not created yet or was cleared.
220 if inner.search_path.is_empty() {
221 return Ok(());
222 }
223 for (i, item) in inner.search_path.iter().enumerate() {
224 if item.get_id() == search_function.get_id() {
225 if !inner.search_cache.is_empty() {
226 inner.search_cache.clear();
227 }
228 inner.search_path.remove(i);
229 return Ok(());
230 }
231 }
232 Ok(())
233 }
234
235 pub(crate) fn register_manual(&self, name: &str, codec: PyCodec) -> PyResult<()> {
236 let name = normalize_encoding_name(name);

Callers 1

unregisterFunction · 0.45

Calls 6

writeMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45
get_idMethod · 0.45
clearMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected