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

Method try_index

crates/vm/src/protocol/number.rs:38–45  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

36
37 #[inline]
38 pub fn try_index(&self, vm: &VirtualMachine) -> PyResult<PyIntRef> {
39 self.try_index_opt(vm).transpose()?.ok_or_else(|| {
40 vm.new_type_error(format!(
41 "'{}' object cannot be interpreted as an integer",
42 self.class()
43 ))
44 })
45 }
46
47 pub fn try_int(&self, vm: &VirtualMachine) -> PyResult<PyIntRef> {
48 fn try_convert(obj: &PyObject, lit: &[u8], vm: &VirtualMachine) -> PyResult<PyIntRef> {

Callers 15

getrandbitsMethod · 0.80
value_from_objectFunction · 0.80
slot_initMethod · 0.80
key_as_isizeMethod · 0.80
try_from_objectMethod · 0.80
try_intMethod · 0.80
indexFunction · 0.80
getsizeofFunction · 0.80
roundFunction · 0.80
get_indexMethod · 0.80

Calls 2

ok_or_elseMethod · 0.80
try_index_optMethod · 0.80

Tested by

no test coverage detected