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

Method __getitem__

flow-message/src/cross/python/map.rs:27–35  ·  view source on GitHub ↗
(&self, attr: &str)

Source from the content-addressed store, hash-verified

25 }
26
27 fn __getitem__(&self, attr: &str) -> PyResult<PyObject> {
28 let gil = Python::acquire_gil();
29 let py = gil.python();
30 if let Some(data) = self.as_ref().get(attr) {
31 from_data(py, data)
32 } else {
33 Err(pyo3::exceptions::PyTypeError::new_err("Key Error"))
34 }
35 }
36
37 fn __delitem__(&mut self, attr: &str) -> PyResult<()> {
38 self.as_mut().remove(attr);

Callers

nothing calls this directly

Calls 3

from_dataFunction · 0.85
as_refMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected