Method
groups
(&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 | } |