MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / __getitem__

Method __getitem__

flow-message/src/cross/python/cow_list.rs:30–40  ·  view source on GitHub ↗
(&self, idx: isize)

Source from the content-addressed store, hash-verified

28 }
29
30 fn __getitem__(&self, idx: isize) -> PyResult<PyObject> {
31 let gil = Python::acquire_gil();
32 let py = gil.python();
33 let len = self.as_ref().len();
34 let idx = cvt_idx(len, idx);
35 if let Some(data) = self.as_ref().get(idx) {
36 from_data(py, data)
37 } else {
38 Err(pyo3::exceptions::PyTypeError::new_err("Idx out of bound"))
39 }
40 }
41
42 fn __delitem__(&mut self, idx: isize) -> PyResult<()> {
43 let len = self.as_ref().len();

Callers

nothing calls this directly

Calls 5

cvt_idxFunction · 0.85
from_dataFunction · 0.85
as_refMethod · 0.80
lenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected