(
name: PyObjectRef,
mut _rest: FuncArgs,
vm: &VirtualMachine,
)
| 290 | |
| 291 | #[pyfunction] |
| 292 | fn get_dialect( |
| 293 | name: PyObjectRef, |
| 294 | mut _rest: FuncArgs, |
| 295 | vm: &VirtualMachine, |
| 296 | ) -> PyResult<PyDialect> { |
| 297 | let name = name.downcast::<PyStr>().map_err(|obj| { |
| 298 | new_csv_error( |
| 299 | vm, |
| 300 | format!("argument 0 must be a string, not '{}'", obj.class()), |
| 301 | ) |
| 302 | })?; |
| 303 | let name: PyUtf8StrRef = name.try_into_utf8(vm)?; |
| 304 | let g = GLOBAL_HASHMAP.lock(); |
| 305 | if let Some(dialect) = g.get(name.as_str()) { |
| 306 | return Ok(*dialect); |
| 307 | } |
| 308 | Err(new_csv_error(vm, "unknown dialect")) |
| 309 | } |
| 310 | |
| 311 | #[pyfunction] |
| 312 | fn unregister_dialect( |
nothing calls this directly
no test coverage detected