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

Method get_chain

crates/vm/src/builtins/dict.rs:748–766  ·  view source on GitHub ↗
(
        &self,
        other: &Self,
        key: &K,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

746 }
747
748 pub fn get_chain<K: DictKey + ?Sized>(
749 &self,
750 other: &Self,
751 key: &K,
752 vm: &VirtualMachine,
753 ) -> PyResult<Option<PyObjectRef>> {
754 let self_exact = self.exact_dict(vm);
755 let other_exact = other.exact_dict(vm);
756 if self_exact && other_exact {
757 // SAFETY: exact_dict checks passed
758 let self_exact = unsafe { PyExact::ref_unchecked(self) };
759 let other_exact = unsafe { PyExact::ref_unchecked(other) };
760 self_exact.get_chain_exact(other_exact, key, vm)
761 } else if let Some(value) = self.get_item_opt(key, vm)? {
762 Ok(Some(value))
763 } else {
764 other.get_item_opt(key, vm)
765 }
766 }
767}
768
769impl PyExact<PyDict> {

Callers 1

get_chain_exactMethod · 0.45

Calls 4

exact_dictMethod · 0.80
get_chain_exactMethod · 0.80
get_item_optMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected