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

Function unregister_dialect

crates/stdlib/src/csv.rs:312–329  ·  view source on GitHub ↗
(
        name: PyObjectRef,
        mut _rest: FuncArgs,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

310
311 #[pyfunction]
312 fn unregister_dialect(
313 name: PyObjectRef,
314 mut _rest: FuncArgs,
315 vm: &VirtualMachine,
316 ) -> PyResult<()> {
317 let name = name.downcast::<PyStr>().map_err(|obj| {
318 new_csv_error(
319 vm,
320 format!("argument 0 must be a string, not '{}'", obj.class()),
321 )
322 })?;
323 let name: PyUtf8StrRef = name.try_into_utf8(vm)?;
324 let mut g = GLOBAL_HASHMAP.lock();
325 if let Some(_removed) = g.remove(name.as_str()) {
326 return Ok(());
327 }
328 Err(new_csv_error(vm, "unknown dialect"))
329 }
330
331 #[pyfunction]
332 fn list_dialects(

Callers

nothing calls this directly

Calls 6

new_csv_errorFunction · 0.85
try_into_utf8Method · 0.80
ErrClass · 0.50
lockMethod · 0.45
removeMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected