MCPcopy Create free account
hub / github.com/AimRT/AimRT / _SerializeProtobufMessage

Function _SerializeProtobufMessage

src/runtime/python_runtime/aimrt_py_chn.py:18–24  ·  view source on GitHub ↗
(pb_msg: google.protobuf.message.Message, serialization_type: str)

Source from the content-addressed store, hash-verified

16
17
18def _SerializeProtobufMessage(pb_msg: google.protobuf.message.Message, serialization_type: str) -> bytes:
19 if serialization_type == "pb":
20 return pb_msg.SerializeToString()
21 elif serialization_type == "json":
22 return google.protobuf.json_format.MessageToJson(pb_msg)
23 else:
24 raise ValueError(f"Invalid serialization type: {serialization_type}")
25
26
27def _DeserializeProtobufMessage(msg_buf: bytes,

Callers 1

PublishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected