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

Method groups

crates/stdlib/src/re.rs:436–451  ·  view source on GitHub ↗
(&self, default: OptionalArg, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

434
435 #[pymethod]
436 fn groups(&self, default: OptionalArg, vm: &VirtualMachine) -> PyTupleRef {
437 let default = default.into_option();
438 let groups = self
439 .captures
440 .iter()
441 .map(|capture| {
442 vm.unwrap_or_none(
443 capture
444 .as_ref()
445 .map(|bounds| self.subgroup(bounds.clone()).to_pyobject(vm))
446 .or_else(|| default.clone()),
447 )
448 })
449 .collect();
450 vm.ctx.new_tuple(groups)
451 }
452 }
453}

Callers 3

parse_requirementFunction · 0.45
get_versionsFunction · 0.45
replace_compiledFunction · 0.45

Calls 10

into_optionMethod · 0.80
collectMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
unwrap_or_noneMethod · 0.45
as_refMethod · 0.45
to_pyobjectMethod · 0.45
subgroupMethod · 0.45
cloneMethod · 0.45
new_tupleMethod · 0.45

Tested by 1

replace_compiledFunction · 0.36