MCPcopy Create free account
hub / github.com/AdrianEddy/telemetry-parser / telemetry

Method telemetry

bin/python-module/python-module.rs:38–67  ·  view source on GitHub ↗
(&self, py: Python<'py>, human_readable: Option<bool>)

Source from the content-addressed store, hash-verified

36
37 #[pyo3(signature = (human_readable=None))]
38 fn telemetry<'py>(&self, py: Python<'py>, human_readable: Option<bool>) -> PyResult<Bound<'py, PyAny>> {
39 let input = self.input.lock_py_attached(py).unwrap();
40 if input.samples.is_none() { return Err(pyo3::exceptions::PyValueError::new_err("No metadata")); }
41
42 let samples = input.samples.as_ref().unwrap();
43 let mut output = Vec::with_capacity(samples.len());
44
45 for info in samples {
46 if info.tag_map.is_none() { continue; }
47
48 let mut groups = BTreeMap::new();
49 let groups_map = info.tag_map.as_ref().unwrap();
50
51 for (group, map) in groups_map {
52 let group_map = groups.entry(group).or_insert_with(BTreeMap::new);
53 for (tagid, info) in map {
54 let value = if human_readable.unwrap_or(false) {
55 serde_json::to_value(info.value.to_string())
56 } else {
57 serde_json::to_value(info.value.clone())
58 }.unwrap();
59 group_map.insert(tagid, value);
60 }
61 }
62
63 output.push(groups);
64 }
65
66 Ok(pythonize(py, &output)?)
67 }
68
69 #[pyo3(signature = (orientation=None))]
70 fn normalized_imu<'py>(&self, py: Python<'py>, orientation: Option<String>) -> PyResult<Bound<'py, PyAny>> {

Callers

nothing calls this directly

Calls 2

entryMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected