Function
_SerializeProtobufMessage
(pb_msg: google.protobuf.message.Message, serialization_type: str)
Source from the content-addressed store, hash-verified
| 16 | |
| 17 | |
| 18 | def _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 | |
| 27 | def _DeserializeProtobufMessage(msg_buf: bytes, |
Tested by
no test coverage detected