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

Method get_bounds

crates/stdlib/src/re.rs:391–408  ·  view source on GitHub ↗
(
            &self,
            id: PyObjectRef,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

389 }
390
391 fn get_bounds(
392 &self,
393 id: PyObjectRef,
394 vm: &VirtualMachine,
395 ) -> PyResult<Option<Range<usize>>> {
396 match_class!(match id {
397 i @ PyInt => {
398 let i = usize::try_from_object(vm, i.into())?;
399 let capture = self
400 .captures
401 .get(i)
402 .ok_or_else(|| vm.new_index_error("No such group".to_owned()))?;
403 Ok(capture.clone())
404 }
405 _s @ PyStr => unimplemented!(),
406 _ => Err(vm.new_index_error("No such group".to_owned())),
407 })
408 }
409
410 fn get_group(&self, id: PyObjectRef, vm: &VirtualMachine) -> PyResult<Option<String>> {
411 let bounds = self.get_bounds(id, vm)?;

Callers 3

startMethod · 0.80
endMethod · 0.80
get_groupMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected