mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
protobuf text_format now prints in both binary and hex form
This commit is contained in:
parent
2782655320
commit
eb22fad568
@ -90,9 +90,8 @@ def monkeypatch_google_protobuf_text_format():
|
|||||||
|
|
||||||
def _customPrintFieldValue(field, value, out, indent=0, as_utf8=False, as_one_line=False):
|
def _customPrintFieldValue(field, value, out, indent=0, as_utf8=False, as_one_line=False):
|
||||||
if field.cpp_type == google.protobuf.descriptor.FieldDescriptor.CPPTYPE_STRING and \
|
if field.cpp_type == google.protobuf.descriptor.FieldDescriptor.CPPTYPE_STRING and \
|
||||||
str(field.GetOptions()).strip() == '[binary]:': # binary option set
|
'[binary]:' in str(field.GetOptions()).strip(): # binary option set
|
||||||
_oldPrintFieldValue(field, 'hex(%s) str(%s)' % (binascii.hexlify(value), value), out, indent, as_utf8, as_one_line)
|
_oldPrintFieldValue(field, 'hex(%s) | str(%s)' % (binascii.hexlify(value), value), out, indent, as_utf8, as_one_line)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_oldPrintFieldValue(field, value, out, indent, as_utf8, as_one_line)
|
_oldPrintFieldValue(field, value, out, indent, as_utf8, as_one_line)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user