Get the debug string of a protobuf message. The message could be not initialized. Args: proto(google.protobuf.message.Message): The protobuf message throw_on_error(bool): True if raise an error when the protobuf message is not initialized. Returns(str):
(proto, throw_on_error=True)
| 1549 | |
| 1550 | |
| 1551 | def _debug_string_(proto, throw_on_error=True): |
| 1552 | """ |
| 1553 | Get the debug string of a protobuf message. The message could be not |
| 1554 | initialized. |
| 1555 | Args: |
| 1556 | proto(google.protobuf.message.Message): The protobuf message |
| 1557 | throw_on_error(bool): True if raise an error when the protobuf message |
| 1558 | is not initialized. |
| 1559 | |
| 1560 | Returns(str): The debug string of the protobuf message |
| 1561 | |
| 1562 | """ |
| 1563 | error_fields = [] |
| 1564 | if not proto.IsInitialized(error_fields) and throw_on_error: |
| 1565 | raise ValueError( |
| 1566 | f"{error_fields} are not initialized.\nThe message is {proto}:\n" |
| 1567 | ) |
| 1568 | return proto.__str__() |
| 1569 | |
| 1570 | |
| 1571 | def _create_tensor( |
no test coverage detected