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

Method contains

crates/vm/src/protocol/sequence.rs:396–411  ·  view source on GitHub ↗
(self, target: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

394 }
395
396 pub fn contains(self, target: &PyObject, vm: &VirtualMachine) -> PyResult<bool> {
397 if let Some(f) = self.slots().contains.load() {
398 return f(self, target, vm);
399 }
400
401 let iter = self.obj.to_owned().get_iter(vm)?;
402 let iter = iter.iter::<PyObjectRef>(vm)?;
403
404 for elem in iter {
405 let elem = elem?;
406 if vm.bool_eq(&elem, target)? {
407 return Ok(true);
408 }
409 }
410 Ok(false)
411 }
412}

Callers 15

has_featureMethod · 0.45
is_created_with_flagsMethod · 0.45
to_proper_methodMethod · 0.45
getpwnamFunction · 0.45
is_importedMethod · 0.45
is_nonlocalMethod · 0.45
is_referencedMethod · 0.45
is_assignedMethod · 0.45
is_parameterMethod · 0.45
is_annotatedMethod · 0.45
spawnveFunction · 0.45
execveFunction · 0.45

Calls 6

get_iterMethod · 0.80
bool_eqMethod · 0.80
fFunction · 0.50
loadMethod · 0.45
slotsMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected