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

Method __contains__

crates/stdlib/src/array.rs:1171–1185  ·  view source on GitHub ↗
(&self, value: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1169 }
1170
1171 fn __contains__(&self, value: PyObjectRef, vm: &VirtualMachine) -> bool {
1172 let array = self.array.read();
1173 for element in array
1174 .iter(vm)
1175 .map(|x| x.expect("Expected to be checked by array.len() and read lock."))
1176 {
1177 if let Ok(true) =
1178 element.rich_compare_bool(value.as_object(), PyComparisonOp::Eq, vm)
1179 {
1180 return true;
1181 }
1182 }
1183
1184 false
1185 }
1186
1187 #[pyclassmethod]
1188 fn __class_getitem__(

Callers

nothing calls this directly

Calls 5

rich_compare_boolMethod · 0.80
readMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected