MCPcopy Create free account
hub / github.com/NVIDIA-NeMo/Switchyard / to_python

Function to_python

crates/switchyard-py/src/py_serde.rs:21–25  ·  view source on GitHub ↗

Converts a serializable Rust value into Python dictionaries and lists.

(py: Python<'_>, value: &T)

Source from the content-addressed store, hash-verified

19
20/// Converts a serializable Rust value into Python dictionaries and lists.
21pub(crate) fn to_python<T: Serialize>(py: Python<'_>, value: &T) -> PyResult<Py<PyAny>> {
22 pythonize(py, value)
23 .map(|object| object.unbind())
24 .map_err(|error| PyValueError::new_err(error.to_string()))
25}
26
27/// Converts an arbitrary Python object into a JSON value.
28pub(crate) fn value_from_python(value: &Bound<'_, PyAny>) -> PyResult<Value> {

Callers 3

callMethod · 0.70
runMethod · 0.70
value_to_pythonFunction · 0.70

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected