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

Function prase_quoting_from_obj

crates/stdlib/src/csv.rs:224–237  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &PyObject)

Source from the content-addressed store, hash-verified

222 })
223 }
224 fn prase_quoting_from_obj(vm: &VirtualMachine, obj: &PyObject) -> PyResult<QuoteStyle> {
225 match_class!(match obj.get_attr("quoting", vm)? {
226 i @ PyInt => {
227 Ok(i.try_to_primitive::<isize>(vm)?.try_into().map_err(|_| {
228 let msg = r#"bad "quoting" value"#;
229 vm.new_type_error(msg.to_owned())
230 })?)
231 }
232 attr => {
233 let msg = format!(r#""quoting" must be string or None, not {}"#, attr.class());
234 Err(vm.new_type_error(msg.to_owned()))
235 }
236 })
237 }
238 impl TryFromObject for PyDialect {
239 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
240 let delimiter = parse_delimiter_from_obj(vm, &obj)?;

Callers 1

try_from_objectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected