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

Method indices

crates/vm/src/builtins/slice.rs:237–245  ·  view source on GitHub ↗
(&self, length: ArgIndex, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

235
236 #[pymethod]
237 fn indices(&self, length: ArgIndex, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
238 let length = length.into_int_ref();
239 let length = length.as_bigint();
240 if length.is_negative() {
241 return Err(vm.new_value_error("length should not be negative."));
242 }
243 let (start, stop, step) = self.inner_indices(length, vm)?;
244 Ok(vm.new_tuple((start, stop, step)))
245 }
246
247 #[allow(clippy::type_complexity)]
248 #[pymethod]

Callers 9

__getitem__Method · 0.80
check_indicesMethod · 0.80
test_indicesMethod · 0.80
test_pickleMethod · 0.80
test_sliceMethod · 0.80
test_subclassesMethod · 0.80
test_getitemMethod · 0.80
test_issue11845Method · 0.80
builtin_slice.pyFile · 0.80

Calls 5

into_int_refMethod · 0.80
as_bigintMethod · 0.80
inner_indicesMethod · 0.80
ErrClass · 0.50
new_tupleMethod · 0.45

Tested by 7

check_indicesMethod · 0.64
test_indicesMethod · 0.64
test_pickleMethod · 0.64
test_sliceMethod · 0.64
test_subclassesMethod · 0.64
test_getitemMethod · 0.64
test_issue11845Method · 0.64