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

Method get_or_insert

crates/vm/src/builtins/dict.rs:225–232  ·  view source on GitHub ↗
(
        &self,
        vm: &VirtualMachine,
        key: PyObjectRef,
        default: impl FnOnce() -> PyObjectRef,
    )

Source from the content-addressed store, hash-verified

223 }
224
225 pub fn get_or_insert(
226 &self,
227 vm: &VirtualMachine,
228 key: PyObjectRef,
229 default: impl FnOnce() -> PyObjectRef,
230 ) -> PyResult {
231 self.entries.setdefault(vm, &*key, default)
232 }
233
234 pub fn from_attributes(attrs: PyAttributes, vm: &VirtualMachine) -> PyResult<Self> {
235 let entries = DictContentType::default();

Callers 1

get_importerFunction · 0.80

Calls 1

setdefaultMethod · 0.45

Tested by

no test coverage detected