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

Method _contains

crates/vm/src/builtins/mappingproxy.rs:121–130  ·  view source on GitHub ↗
(&self, key: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

119 }
120
121 fn _contains(&self, key: &PyObject, vm: &VirtualMachine) -> PyResult<bool> {
122 match &self.mapping {
123 MappingProxyInner::Class(class) => Ok(key
124 .as_interned_str(vm)
125 .is_some_and(|key| class.attributes.read().contains_key(key))),
126 MappingProxyInner::Mapping(mapping) => {
127 mapping.obj().sequence_unchecked().contains(key, vm)
128 }
129 }
130 }
131
132 pub fn __contains__(&self, key: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {
133 self._contains(&key, vm)

Callers 1

__contains__Method · 0.45

Calls 6

contains_keyMethod · 0.80
sequence_uncheckedMethod · 0.80
as_interned_strMethod · 0.45
readMethod · 0.45
containsMethod · 0.45
objMethod · 0.45

Tested by

no test coverage detected