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

Function get_dict_opt_u32

crates/stdlib/src/lzma.rs:208–220  ·  view source on GitHub ↗
(
        spec: &PyObjectRef,
        key: &str,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

206 }
207
208 fn get_dict_opt_u32(
209 spec: &PyObjectRef,
210 key: &str,
211 vm: &VirtualMachine,
212 ) -> PyResult<Option<u32>> {
213 let dict = spec.downcast_ref::<PyDict>().ok_or_else(|| {
214 vm.new_type_error("Filter specifier must be a dict or dict-like object")
215 })?;
216 match dict.get_item_opt(key, vm)? {
217 Some(obj) => Ok(Some(obj.try_into_value::<u32>(vm)?)),
218 None => Ok(None),
219 }
220 }
221
222 fn get_dict_opt_u64(
223 spec: &PyObjectRef,

Callers 4

parse_filter_spec_lzmaFunction · 0.85
parse_filter_spec_deltaFunction · 0.85
parse_filter_spec_bcjFunction · 0.85

Calls 3

ok_or_elseMethod · 0.80
get_item_optMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected