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

Method get

crates/vm/src/builtins/dict.rs:328–338  ·  view source on GitHub ↗
(
        &self,
        key: PyObjectRef,
        default: OptionalArg<PyObjectRef>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

326
327 #[pymethod]
328 fn get(
329 &self,
330 key: PyObjectRef,
331 default: OptionalArg<PyObjectRef>,
332 vm: &VirtualMachine,
333 ) -> PyResult {
334 match self.entries.get(vm, &*key)? {
335 Some(value) => Ok(value),
336 None => Ok(default.unwrap_or_none(vm)),
337 }
338 }
339
340 #[pymethod]
341 fn setdefault(

Callers 2

inner_getitemMethod · 0.45
get_item_optMethod · 0.45

Calls 1

unwrap_or_noneMethod · 0.45

Tested by

no test coverage detected