From fb7b85e479869e4dc83f5007a11ec77f40225fa6 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 28 Sep 2016 18:01:23 +0200 Subject: [PATCH] move protobuf to a single module --- src/lib/{protobuf => }/protobuf.py | 2 +- src/lib/protobuf/loader.py | 55 ---- src/lib/protobuf/protobuf_buffering.py | 263 ------------------ src/trezor/messages/Address.py | 2 +- src/trezor/messages/ApplySettings.py | 2 +- src/trezor/messages/ButtonAck.py | 2 +- src/trezor/messages/ButtonRequest.py | 2 +- src/trezor/messages/Cancel.py | 2 +- src/trezor/messages/ChangePin.py | 2 +- src/trezor/messages/CipherKeyValue.py | 2 +- src/trezor/messages/CipheredKeyValue.py | 2 +- src/trezor/messages/ClearSession.py | 2 +- src/trezor/messages/CoinType.py | 2 +- src/trezor/messages/DebugLinkDecision.py | 2 +- src/trezor/messages/DebugLinkGetState.py | 2 +- src/trezor/messages/DebugLinkLog.py | 2 +- src/trezor/messages/DebugLinkState.py | 2 +- src/trezor/messages/DebugLinkStop.py | 2 +- src/trezor/messages/DecryptMessage.py | 2 +- src/trezor/messages/DecryptedMessage.py | 2 +- src/trezor/messages/EncryptMessage.py | 2 +- src/trezor/messages/EncryptedMessage.py | 2 +- src/trezor/messages/Entropy.py | 2 +- src/trezor/messages/EntropyAck.py | 2 +- src/trezor/messages/EntropyRequest.py | 2 +- src/trezor/messages/EstimateTxSize.py | 2 +- src/trezor/messages/Failure.py | 2 +- src/trezor/messages/Features.py | 2 +- src/trezor/messages/FirmwareErase.py | 2 +- src/trezor/messages/FirmwareUpload.py | 2 +- src/trezor/messages/GetAddress.py | 2 +- src/trezor/messages/GetEntropy.py | 2 +- src/trezor/messages/GetFeatures.py | 2 +- src/trezor/messages/GetPublicKey.py | 2 +- src/trezor/messages/HDNodePathType.py | 2 +- src/trezor/messages/HDNodeType.py | 2 +- src/trezor/messages/IdentityType.py | 2 +- src/trezor/messages/Initialize.py | 2 +- src/trezor/messages/LoadDevice.py | 2 +- src/trezor/messages/MessageSignature.py | 2 +- .../messages/MultisigRedeemScriptType.py | 2 +- src/trezor/messages/PassphraseAck.py | 2 +- src/trezor/messages/PassphraseRequest.py | 2 +- src/trezor/messages/PinMatrixAck.py | 2 +- src/trezor/messages/PinMatrixRequest.py | 2 +- src/trezor/messages/Ping.py | 2 +- src/trezor/messages/PublicKey.py | 2 +- src/trezor/messages/RecoveryDevice.py | 2 +- src/trezor/messages/ResetDevice.py | 2 +- src/trezor/messages/SignIdentity.py | 2 +- src/trezor/messages/SignMessage.py | 2 +- src/trezor/messages/SignTx.py | 2 +- src/trezor/messages/SignedIdentity.py | 2 +- src/trezor/messages/SimpleSignTx.py | 2 +- src/trezor/messages/Storage.py | 2 +- src/trezor/messages/Success.py | 2 +- src/trezor/messages/TransactionType.py | 2 +- src/trezor/messages/TxAck.py | 2 +- src/trezor/messages/TxInputType.py | 2 +- src/trezor/messages/TxOutputBinType.py | 2 +- src/trezor/messages/TxOutputType.py | 2 +- src/trezor/messages/TxRequest.py | 2 +- src/trezor/messages/TxRequestDetailsType.py | 2 +- .../messages/TxRequestSerializedType.py | 2 +- src/trezor/messages/TxSize.py | 2 +- src/trezor/messages/VerifyMessage.py | 2 +- src/trezor/messages/WipeDevice.py | 2 +- src/trezor/messages/WordAck.py | 2 +- src/trezor/messages/WordRequest.py | 2 +- src/trezor/wire/__init__.py | 2 +- tools/pb2py | 2 +- 71 files changed, 69 insertions(+), 387 deletions(-) rename src/lib/{protobuf => }/protobuf.py (99%) delete mode 100644 src/lib/protobuf/loader.py delete mode 100644 src/lib/protobuf/protobuf_buffering.py diff --git a/src/lib/protobuf/protobuf.py b/src/lib/protobuf.py similarity index 99% rename from src/lib/protobuf/protobuf.py rename to src/lib/protobuf.py index f5af066668..a81761f1ca 100644 --- a/src/lib/protobuf/protobuf.py +++ b/src/lib/protobuf.py @@ -116,7 +116,7 @@ class EmbeddedMessage: return self.message_type() def dump(self, target, value): - buf = self.message_type.dumps(value) + buf = yield from self.message_type.dumps(value) yield from BytesType.dump(target, buf) def load(self, target, source): diff --git a/src/lib/protobuf/loader.py b/src/lib/protobuf/loader.py deleted file mode 100644 index a1d186ab64..0000000000 --- a/src/lib/protobuf/loader.py +++ /dev/null @@ -1,55 +0,0 @@ -# Describing messages themselves. ---------------------------------------------- -from . import protobuf - -class TypeMetadataType: - - WIRE_TYPE = 2 - - def __init__(self): - # Field description. - self.__field_metadata_type = protobuf.MessageType() - self.__field_metadata_type.add_field(1, 'tag', protobuf.UVarintType, flags=protobuf.Flags.REQUIRED) - self.__field_metadata_type.add_field(2, 'name', protobuf.BytesType, flags=protobuf.Flags.REQUIRED) - self.__field_metadata_type.add_field(3, 'type', protobuf.BytesType, flags=protobuf.Flags.REQUIRED) - self.__field_metadata_type.add_field(4, 'flags', protobuf.UVarintType, flags=protobuf.Flags.REQUIRED) - self.__field_metadata_type.add_field(5, 'embedded', protobuf.EmbeddedMessage(self)) # Used to describe embedded messages. - # Metadata message description. - self.__self_type = protobuf.EmbeddedMessage(protobuf.MessageType()) - self.__self_type.message_type.add_field(1, 'fields', protobuf.EmbeddedMessage(self.__field_metadata_type), flags=(Flags.REPEATED | Flags.REQUIRED)) - - def __create_message(self, message_type): - # Creates a message that contains info about the message_type. - message, message.fields = self.__self_type(), list() - for field in iter(message_type): - field_meta = self.__field_metadata_type() - field_meta.tag, field_meta.name, field_type, field_meta.flags = field - field_meta.type = type_str = field_type.__class__.__name__ - if isinstance(field_type, protobuf.EmbeddedMessage): - field_meta.flags |= protobuf.Flags.EMBEDDED - field_meta.embedded_metadata = self.__create_message(field_type.message_type) - elif not type_str.endswith('Type'): - raise TypeError('Type name of type singleton object should end with \'Type\'. Actual: \'%s\'.' % type_str) - else: - field_meta.type = type_str[:-4] - message.fields.append(field_meta) - return message - - def dump(self, fp, message_type): - self.__self_type.dump(fp, self.__create_message(message_type)) - - def __restore_type(self, message): - # Restores a message type by the information in the message. - message_type, g = protobuf.MessageType(), globals() - for field in message.fields: - field_type = field['type'] - if not field_type in g: - raise TypeError('Primitive type \'%s\' not found in this protobuf module.' % field_type) - field_info = (field.tag, field.name, g[field_type], field.flags) - if field.flags & protobuf.Flags.EMBEDDED_MASK == protobuf.Flags.EMBEDDED: - field_info[3] -= protobuf.Flags.EMBEDDED - field_info[2] = protobuf.EmbeddedMessage(self.__restore_type(field.embedded)) - message_type.add_field(*field_info) - return message_type - - def load(self, fp): - return self.__restore_type(self.__self_type.load(fp)) diff --git a/src/lib/protobuf/protobuf_buffering.py b/src/lib/protobuf/protobuf_buffering.py deleted file mode 100644 index 7ff4b33053..0000000000 --- a/src/lib/protobuf/protobuf_buffering.py +++ /dev/null @@ -1,263 +0,0 @@ -# Implements the Google's protobuf encoding. -# eigenein (c) 2011 -# http://eigenein.me/protobuf/ - -from uio import BytesIO - -# Types. ----------------------------------------------------------------- - - -class UVarintType: - # Represents an unsigned Varint type. - WIRE_TYPE = 0 - - @staticmethod - def dump(fp, value): - shifted_value = True - while shifted_value: - shifted_value = value >> 7 - fp.write(chr((value & 0x7F) | (0x80 if shifted_value != 0 else 0x00))) - value = shifted_value - - @staticmethod - def load(fp): - value, shift, quantum = 0, 0, 0x80 - while (quantum & 0x80) == 0x80: - quantum = ord(fp.read(1)) - value, shift = value + ((quantum & 0x7F) << shift), shift + 7 - return value - - -class BoolType: - # Represents a boolean type. - # Encodes True as UVarint 1, and False as UVarint 0. - WIRE_TYPE = 0 - - @staticmethod - def dump(fp, value): - fp.write('\x01' if value else '\x00') - - @staticmethod - def load(fp): - return UVarintType.load(fp) != 0 - - -class BytesType: - # Represents a raw bytes type. - WIRE_TYPE = 2 - - @staticmethod - def dump(fp, value): - UVarintType.dump(fp, len(value)) - fp.write(value) - - @staticmethod - def load(fp): - return fp.read(UVarintType.load(fp)) - - -class UnicodeType: - # Represents an unicode string type. - WIRE_TYPE = 2 - - @staticmethod - def dump(fp, value): - BytesType.dump(fp, bytes(value, 'utf-8')) - - @staticmethod - def load(fp): - return BytesType.load(fp).decode('utf-8', 'strict') - - -# Messages. -------------------------------------------------------------- - -FLAG_SIMPLE = const(0) -FLAG_REQUIRED = const(1) -FLAG_REQUIRED_MASK = const(1) -FLAG_SINGLE = const(0) -FLAG_REPEATED = const(2) -FLAG_REPEATED_MASK = const(6) - - -class EofWrapper: - # Wraps a stream to raise EOFError instead of just returning of ''. - - def __init__(self, fp, limit=None): - self.__fp = fp - self.__limit = limit - - def read(self, size=None): - # Reads a string. Raises EOFError on end of stream. - if self.__limit is not None: - size = min(size, self.__limit) - self.__limit -= size - s = self.__fp.read(size) - if len(s) == 0: - raise EOFError() - return s - - -# Packs a tag and a wire_type into single int according to the protobuf spec. -_pack_key = lambda tag, wire_type: (tag << 3) | wire_type -# Unpacks a key into a tag and a wire_type according to the protobuf spec. -_unpack_key = lambda key: (key >> 3, key & 7) - - -class MessageType: - # Represents a message type. - - def __init__(self, name=None): - # Creates a new message type. - self.__tags_to_types = {} # Maps a tag to a type instance. - self.__tags_to_names = {} # Maps a tag to a given field name. - self.__defaults = {} # Maps a tag to its default value. - self.__flags = {} # Maps a tag to FLAG_ - self.__name = name - - def add_field(self, tag, name, field_type, flags=FLAG_SIMPLE, default=None): - # Adds a field to the message type. - if tag in self.__tags_to_names or tag in self.__tags_to_types: - raise ValueError('The tag %s is already used.' % tag) - if default != None: - self.__defaults[tag] = default - self.__tags_to_names[tag] = name - self.__tags_to_types[tag] = field_type - self.__flags[tag] = flags - return self # Allow add_field chaining. - - def __call__(self, **fields): - # Creates an instance of this message type. - return Message(self, **fields) - - def __has_flag(self, tag, flag, mask): - # Checks whether the field with the specified tag has the specified - # flag. - return (self.__flags[tag] & mask) == flag - - def dump(self, fp, value): - if self != value.message_type: - raise TypeError("Incompatible type") - for tag, field_type in iter(self.__tags_to_types.items()): - if self.__tags_to_names[tag] in value.__dict__: - if self.__has_flag(tag, FLAG_SINGLE, FLAG_REPEATED_MASK): - # Single value. - UVarintType.dump(fp, _pack_key(tag, field_type.WIRE_TYPE)) - field_type.dump(fp, getattr( - value, self.__tags_to_names[tag])) - elif self.__has_flag(tag, FLAG_REPEATED, FLAG_REPEATED_MASK): - # Repeated value. - key = _pack_key(tag, field_type.WIRE_TYPE) - # Put it together sequently. - for single_value in getattr(value, self.__tags_to_names[tag]): - UVarintType.dump(fp, key) - field_type.dump(fp, single_value) - elif self.__has_flag(tag, FLAG_REQUIRED, FLAG_REQUIRED_MASK): - raise ValueError( - 'The field with the tag %s is required but a value is missing.' % tag) - - def load(self, fp): - fp = EofWrapper(fp) - message = self.__call__() - while True: - try: - tag, wire_type = _unpack_key(UVarintType.load(fp)) - - if tag in self.__tags_to_types: - field_type = self.__tags_to_types[tag] - field_name = self.__tags_to_names[tag] - if wire_type != field_type.WIRE_TYPE: - raise TypeError( - 'Value of tag %s has incorrect wiretype %s, %s expected.' % - (tag, wire_type, field_type.WIRE_TYPE)) - if self.__has_flag(tag, FLAG_SINGLE, FLAG_REPEATED_MASK): - # Single value. - setattr(message, field_name, field_type.load(fp)) - elif self.__has_flag(tag, FLAG_REPEATED, FLAG_REPEATED_MASK): - # Repeated value. - if not field_name in message.__dict__: - setattr(message, field_name, []) - getattr(message, field_name).append( - field_type.load(fp)) - else: - # Skip this field. - - # This used to correctly determine the length of unknown - # tags when loading a message. - {0: UVarintType, 2: BytesType}[wire_type].load(fp) - - except EOFError: - for tag, name in iter(self.__tags_to_names.items()): - # Fill in default value if value not set - if name not in message.__dict__ and tag in self.__defaults: - setattr(message, name, self.__defaults[tag]) - - # Check if all required fields are present. - if self.__has_flag(tag, FLAG_REQUIRED, FLAG_REQUIRED_MASK) and not name in message.__dict__: - if self.__has_flag(tag, FLAG_REPEATED, FLAG_REPEATED_MASK): - # Empty list (no values was in input stream). But - # required field. - setattr(message, name, []) - else: - raise ValueError( - 'The field %s (\'%s\') is required but missing.' % (tag, name)) - return message - - def dumps(self, value): - fp = BytesIO() - self.dump(fp, value) - return fp.getvalue() - - def loads(self, buf): - fp = BytesIO(buf) - return self.load(fp) - - def __repr__(self): - return '' % self.__name - - -class Message: - # Represents a message instance. - - def __init__(self, message_type, **fields): - # Initializes a new instance of the specified message type. - self.message_type = message_type - # In micropython, we cannot use self.__dict__.update(fields), - # iterate fields and assign them directly. - for key in fields: - setattr(self, key, fields[key]) - - def dump(self, fp): - # Dumps the message into a write-like object. - return self.message_type.dump(fp, self) - - def dumps(self): - # Dumps the message into bytes - return self.message_type.dumps(self) - - def __repr__(self): - values = self.__dict__ - values = {k: values[k] for k in values if k != 'message_type'} - return '<%s: %s>' % (self.message_type.__name, values) - - -# Embedded message. ------------------------------------------------------ - -class EmbeddedMessage: - # Represents an embedded message type. - - WIRE_TYPE = 2 - - def __init__(self, message_type): - # Initializes a new instance. The argument is an underlying message - # type. - self.message_type = message_type - - def __call__(self): - # Creates a message of the underlying message type. - return self.message_type() - - def dump(self, fp, value): - BytesType.dump(fp, self.message_type.dumps(value)) - - def load(self, fp): - return self.message_type.load(EofWrapper(fp, UVarintType.load(fp))) diff --git a/src/trezor/messages/Address.py b/src/trezor/messages/Address.py index 0de97f1134..95bfdd9023 100644 --- a/src/trezor/messages/Address.py +++ b/src/trezor/messages/Address.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Address') t.wire_type = 30 t.add_field(1, 'address', p.UnicodeType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/ApplySettings.py b/src/trezor/messages/ApplySettings.py index 1e4e54a70c..a589a4d78d 100644 --- a/src/trezor/messages/ApplySettings.py +++ b/src/trezor/messages/ApplySettings.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ApplySettings') t.wire_type = 25 t.add_field(1, 'language', p.UnicodeType) diff --git a/src/trezor/messages/ButtonAck.py b/src/trezor/messages/ButtonAck.py index 9fc7784950..051a610903 100644 --- a/src/trezor/messages/ButtonAck.py +++ b/src/trezor/messages/ButtonAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ButtonAck') t.wire_type = 27 ButtonAck = t \ No newline at end of file diff --git a/src/trezor/messages/ButtonRequest.py b/src/trezor/messages/ButtonRequest.py index aaba14dcea..3af7055089 100644 --- a/src/trezor/messages/ButtonRequest.py +++ b/src/trezor/messages/ButtonRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ButtonRequest') t.wire_type = 26 t.add_field(1, 'code', p.UVarintType) diff --git a/src/trezor/messages/Cancel.py b/src/trezor/messages/Cancel.py index fdf5af0674..902d72dabb 100644 --- a/src/trezor/messages/Cancel.py +++ b/src/trezor/messages/Cancel.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Cancel') t.wire_type = 20 Cancel = t \ No newline at end of file diff --git a/src/trezor/messages/ChangePin.py b/src/trezor/messages/ChangePin.py index edba512ad0..02e1deb3a2 100644 --- a/src/trezor/messages/ChangePin.py +++ b/src/trezor/messages/ChangePin.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ChangePin') t.wire_type = 4 t.add_field(1, 'remove', p.BoolType) diff --git a/src/trezor/messages/CipherKeyValue.py b/src/trezor/messages/CipherKeyValue.py index 6887599195..1b1952dca9 100644 --- a/src/trezor/messages/CipherKeyValue.py +++ b/src/trezor/messages/CipherKeyValue.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('CipherKeyValue') t.wire_type = 23 t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/CipheredKeyValue.py b/src/trezor/messages/CipheredKeyValue.py index 9f31e723b2..75f48ed31e 100644 --- a/src/trezor/messages/CipheredKeyValue.py +++ b/src/trezor/messages/CipheredKeyValue.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('CipheredKeyValue') t.wire_type = 48 t.add_field(1, 'value', p.BytesType) diff --git a/src/trezor/messages/ClearSession.py b/src/trezor/messages/ClearSession.py index f0ae04f56d..0f18313786 100644 --- a/src/trezor/messages/ClearSession.py +++ b/src/trezor/messages/ClearSession.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ClearSession') t.wire_type = 24 ClearSession = t \ No newline at end of file diff --git a/src/trezor/messages/CoinType.py b/src/trezor/messages/CoinType.py index 5c7721ce9e..bf8a668004 100644 --- a/src/trezor/messages/CoinType.py +++ b/src/trezor/messages/CoinType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('CoinType') t.add_field(1, 'coin_name', p.UnicodeType) t.add_field(2, 'coin_shortcut', p.UnicodeType) diff --git a/src/trezor/messages/DebugLinkDecision.py b/src/trezor/messages/DebugLinkDecision.py index a927755685..ba359f02e9 100644 --- a/src/trezor/messages/DebugLinkDecision.py +++ b/src/trezor/messages/DebugLinkDecision.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DebugLinkDecision') t.wire_type = 100 t.add_field(1, 'yes_no', p.BoolType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/DebugLinkGetState.py b/src/trezor/messages/DebugLinkGetState.py index 621f708a19..06a424d10d 100644 --- a/src/trezor/messages/DebugLinkGetState.py +++ b/src/trezor/messages/DebugLinkGetState.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DebugLinkGetState') t.wire_type = 101 DebugLinkGetState = t \ No newline at end of file diff --git a/src/trezor/messages/DebugLinkLog.py b/src/trezor/messages/DebugLinkLog.py index 2ec093e134..ebd178f755 100644 --- a/src/trezor/messages/DebugLinkLog.py +++ b/src/trezor/messages/DebugLinkLog.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DebugLinkLog') t.wire_type = 104 t.add_field(1, 'level', p.UVarintType) diff --git a/src/trezor/messages/DebugLinkState.py b/src/trezor/messages/DebugLinkState.py index ccd9c58240..5a45a8b7cb 100644 --- a/src/trezor/messages/DebugLinkState.py +++ b/src/trezor/messages/DebugLinkState.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodeType import HDNodeType t = p.MessageType('DebugLinkState') t.wire_type = 102 diff --git a/src/trezor/messages/DebugLinkStop.py b/src/trezor/messages/DebugLinkStop.py index eb15a4c410..3e5775441d 100644 --- a/src/trezor/messages/DebugLinkStop.py +++ b/src/trezor/messages/DebugLinkStop.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DebugLinkStop') t.wire_type = 103 DebugLinkStop = t \ No newline at end of file diff --git a/src/trezor/messages/DecryptMessage.py b/src/trezor/messages/DecryptMessage.py index ada9a00df0..e51490cb0b 100644 --- a/src/trezor/messages/DecryptMessage.py +++ b/src/trezor/messages/DecryptMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DecryptMessage') t.wire_type = 51 t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/DecryptedMessage.py b/src/trezor/messages/DecryptedMessage.py index d1d3f24ab1..ebf4d96e65 100644 --- a/src/trezor/messages/DecryptedMessage.py +++ b/src/trezor/messages/DecryptedMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('DecryptedMessage') t.wire_type = 52 t.add_field(1, 'message', p.BytesType) diff --git a/src/trezor/messages/EncryptMessage.py b/src/trezor/messages/EncryptMessage.py index bfe8cfd9b5..4084bd61c0 100644 --- a/src/trezor/messages/EncryptMessage.py +++ b/src/trezor/messages/EncryptMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('EncryptMessage') t.wire_type = 49 t.add_field(1, 'pubkey', p.BytesType) diff --git a/src/trezor/messages/EncryptedMessage.py b/src/trezor/messages/EncryptedMessage.py index 9eb9e34baa..e4a5e29190 100644 --- a/src/trezor/messages/EncryptedMessage.py +++ b/src/trezor/messages/EncryptedMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('EncryptedMessage') t.wire_type = 50 t.add_field(1, 'nonce', p.BytesType) diff --git a/src/trezor/messages/Entropy.py b/src/trezor/messages/Entropy.py index 48309020e5..39f9839887 100644 --- a/src/trezor/messages/Entropy.py +++ b/src/trezor/messages/Entropy.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Entropy') t.wire_type = 10 t.add_field(1, 'entropy', p.BytesType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/EntropyAck.py b/src/trezor/messages/EntropyAck.py index b33bf1b544..a55c74713d 100644 --- a/src/trezor/messages/EntropyAck.py +++ b/src/trezor/messages/EntropyAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('EntropyAck') t.wire_type = 36 t.add_field(1, 'entropy', p.BytesType) diff --git a/src/trezor/messages/EntropyRequest.py b/src/trezor/messages/EntropyRequest.py index 7d71f76564..5e7dbac50c 100644 --- a/src/trezor/messages/EntropyRequest.py +++ b/src/trezor/messages/EntropyRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('EntropyRequest') t.wire_type = 35 EntropyRequest = t \ No newline at end of file diff --git a/src/trezor/messages/EstimateTxSize.py b/src/trezor/messages/EstimateTxSize.py index 743f2bccf1..70b6a48e54 100644 --- a/src/trezor/messages/EstimateTxSize.py +++ b/src/trezor/messages/EstimateTxSize.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('EstimateTxSize') t.wire_type = 43 t.add_field(1, 'outputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/Failure.py b/src/trezor/messages/Failure.py index 963087fa9d..6edfe0135b 100644 --- a/src/trezor/messages/Failure.py +++ b/src/trezor/messages/Failure.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Failure') t.wire_type = 3 t.add_field(1, 'code', p.UVarintType) diff --git a/src/trezor/messages/Features.py b/src/trezor/messages/Features.py index d6104c74ea..5f87ced5a0 100644 --- a/src/trezor/messages/Features.py +++ b/src/trezor/messages/Features.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .CoinType import CoinType t = p.MessageType('Features') t.wire_type = 17 diff --git a/src/trezor/messages/FirmwareErase.py b/src/trezor/messages/FirmwareErase.py index 56c807c9f4..e1ec08bf18 100644 --- a/src/trezor/messages/FirmwareErase.py +++ b/src/trezor/messages/FirmwareErase.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('FirmwareErase') t.wire_type = 6 FirmwareErase = t \ No newline at end of file diff --git a/src/trezor/messages/FirmwareUpload.py b/src/trezor/messages/FirmwareUpload.py index f4ae7fdd64..b4f3c81d8d 100644 --- a/src/trezor/messages/FirmwareUpload.py +++ b/src/trezor/messages/FirmwareUpload.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('FirmwareUpload') t.wire_type = 7 t.add_field(1, 'payload', p.BytesType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/GetAddress.py b/src/trezor/messages/GetAddress.py index 2c7efab43b..9dfe22d28a 100644 --- a/src/trezor/messages/GetAddress.py +++ b/src/trezor/messages/GetAddress.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .MultisigRedeemScriptType import MultisigRedeemScriptType t = p.MessageType('GetAddress') t.wire_type = 29 diff --git a/src/trezor/messages/GetEntropy.py b/src/trezor/messages/GetEntropy.py index 71d3e56ca2..be81e4b8cc 100644 --- a/src/trezor/messages/GetEntropy.py +++ b/src/trezor/messages/GetEntropy.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('GetEntropy') t.wire_type = 9 t.add_field(1, 'size', p.UVarintType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/GetFeatures.py b/src/trezor/messages/GetFeatures.py index 2c11cddd05..695c90b7eb 100644 --- a/src/trezor/messages/GetFeatures.py +++ b/src/trezor/messages/GetFeatures.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('GetFeatures') t.wire_type = 55 GetFeatures = t \ No newline at end of file diff --git a/src/trezor/messages/GetPublicKey.py b/src/trezor/messages/GetPublicKey.py index eb1f9a865b..374e4edf9b 100644 --- a/src/trezor/messages/GetPublicKey.py +++ b/src/trezor/messages/GetPublicKey.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('GetPublicKey') t.wire_type = 11 t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/HDNodePathType.py b/src/trezor/messages/HDNodePathType.py index 495b0e0920..06271b0d44 100644 --- a/src/trezor/messages/HDNodePathType.py +++ b/src/trezor/messages/HDNodePathType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodeType import HDNodeType t = p.MessageType('HDNodePathType') t.add_field(1, 'node', p.EmbeddedMessage(HDNodeType), flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/HDNodeType.py b/src/trezor/messages/HDNodeType.py index bc9b5f3cff..261af43c5c 100644 --- a/src/trezor/messages/HDNodeType.py +++ b/src/trezor/messages/HDNodeType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('HDNodeType') t.add_field(1, 'depth', p.UVarintType, flags=p.FLAG_REQUIRED) t.add_field(2, 'fingerprint', p.UVarintType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/IdentityType.py b/src/trezor/messages/IdentityType.py index 86784a8bc5..fc9e4d948c 100644 --- a/src/trezor/messages/IdentityType.py +++ b/src/trezor/messages/IdentityType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('IdentityType') t.add_field(1, 'proto', p.UnicodeType) t.add_field(2, 'user', p.UnicodeType) diff --git a/src/trezor/messages/Initialize.py b/src/trezor/messages/Initialize.py index cd6fb39f41..fd475eb46c 100644 --- a/src/trezor/messages/Initialize.py +++ b/src/trezor/messages/Initialize.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Initialize') t.wire_type = 0 Initialize = t \ No newline at end of file diff --git a/src/trezor/messages/LoadDevice.py b/src/trezor/messages/LoadDevice.py index 8ef1a3c8b7..4536502534 100644 --- a/src/trezor/messages/LoadDevice.py +++ b/src/trezor/messages/LoadDevice.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodeType import HDNodeType t = p.MessageType('LoadDevice') t.wire_type = 13 diff --git a/src/trezor/messages/MessageSignature.py b/src/trezor/messages/MessageSignature.py index 5d365171a1..d438a7ae42 100644 --- a/src/trezor/messages/MessageSignature.py +++ b/src/trezor/messages/MessageSignature.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('MessageSignature') t.wire_type = 40 t.add_field(1, 'address', p.UnicodeType) diff --git a/src/trezor/messages/MultisigRedeemScriptType.py b/src/trezor/messages/MultisigRedeemScriptType.py index 319df0de5c..22e50a9361 100644 --- a/src/trezor/messages/MultisigRedeemScriptType.py +++ b/src/trezor/messages/MultisigRedeemScriptType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodePathType import HDNodePathType t = p.MessageType('MultisigRedeemScriptType') t.add_field(1, 'pubkeys', p.EmbeddedMessage(HDNodePathType), flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/PassphraseAck.py b/src/trezor/messages/PassphraseAck.py index f1abee782a..baaf0b10a9 100644 --- a/src/trezor/messages/PassphraseAck.py +++ b/src/trezor/messages/PassphraseAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('PassphraseAck') t.wire_type = 42 t.add_field(1, 'passphrase', p.UnicodeType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/PassphraseRequest.py b/src/trezor/messages/PassphraseRequest.py index 4a1d9b456d..b567f42d10 100644 --- a/src/trezor/messages/PassphraseRequest.py +++ b/src/trezor/messages/PassphraseRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('PassphraseRequest') t.wire_type = 41 PassphraseRequest = t \ No newline at end of file diff --git a/src/trezor/messages/PinMatrixAck.py b/src/trezor/messages/PinMatrixAck.py index 59b5d27087..675492848e 100644 --- a/src/trezor/messages/PinMatrixAck.py +++ b/src/trezor/messages/PinMatrixAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('PinMatrixAck') t.wire_type = 19 t.add_field(1, 'pin', p.UnicodeType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/PinMatrixRequest.py b/src/trezor/messages/PinMatrixRequest.py index c4c47a3e7b..eea9ad5836 100644 --- a/src/trezor/messages/PinMatrixRequest.py +++ b/src/trezor/messages/PinMatrixRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('PinMatrixRequest') t.wire_type = 18 t.add_field(1, 'type', p.UVarintType) diff --git a/src/trezor/messages/Ping.py b/src/trezor/messages/Ping.py index bba774c094..57b133c1ce 100644 --- a/src/trezor/messages/Ping.py +++ b/src/trezor/messages/Ping.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Ping') t.wire_type = 1 t.add_field(1, 'message', p.UnicodeType) diff --git a/src/trezor/messages/PublicKey.py b/src/trezor/messages/PublicKey.py index 1fbc158135..74eacd9372 100644 --- a/src/trezor/messages/PublicKey.py +++ b/src/trezor/messages/PublicKey.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodeType import HDNodeType t = p.MessageType('PublicKey') t.wire_type = 12 diff --git a/src/trezor/messages/RecoveryDevice.py b/src/trezor/messages/RecoveryDevice.py index 796c562f48..35b0613724 100644 --- a/src/trezor/messages/RecoveryDevice.py +++ b/src/trezor/messages/RecoveryDevice.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('RecoveryDevice') t.wire_type = 45 t.add_field(1, 'word_count', p.UVarintType) diff --git a/src/trezor/messages/ResetDevice.py b/src/trezor/messages/ResetDevice.py index 206c8efbea..81ec2c93e7 100644 --- a/src/trezor/messages/ResetDevice.py +++ b/src/trezor/messages/ResetDevice.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('ResetDevice') t.wire_type = 14 t.add_field(1, 'display_random', p.BoolType) diff --git a/src/trezor/messages/SignIdentity.py b/src/trezor/messages/SignIdentity.py index 800bd6d5b0..ab1fe11387 100644 --- a/src/trezor/messages/SignIdentity.py +++ b/src/trezor/messages/SignIdentity.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .IdentityType import IdentityType t = p.MessageType('SignIdentity') t.wire_type = 53 diff --git a/src/trezor/messages/SignMessage.py b/src/trezor/messages/SignMessage.py index d6e2c8a268..eb4591acee 100644 --- a/src/trezor/messages/SignMessage.py +++ b/src/trezor/messages/SignMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('SignMessage') t.wire_type = 38 t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/SignTx.py b/src/trezor/messages/SignTx.py index 51c5f646eb..e316b89094 100644 --- a/src/trezor/messages/SignTx.py +++ b/src/trezor/messages/SignTx.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('SignTx') t.wire_type = 15 t.add_field(1, 'outputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/SignedIdentity.py b/src/trezor/messages/SignedIdentity.py index 0aca313d06..c6ff49d92a 100644 --- a/src/trezor/messages/SignedIdentity.py +++ b/src/trezor/messages/SignedIdentity.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('SignedIdentity') t.wire_type = 54 t.add_field(1, 'address', p.UnicodeType) diff --git a/src/trezor/messages/SimpleSignTx.py b/src/trezor/messages/SimpleSignTx.py index ad6581b3ef..aa51f0f6ff 100644 --- a/src/trezor/messages/SimpleSignTx.py +++ b/src/trezor/messages/SimpleSignTx.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .TxInputType import TxInputType from .TxOutputType import TxOutputType from .TransactionType import TransactionType diff --git a/src/trezor/messages/Storage.py b/src/trezor/messages/Storage.py index d32da56ee4..772883b8ea 100644 --- a/src/trezor/messages/Storage.py +++ b/src/trezor/messages/Storage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .HDNodeType import HDNodeType t = p.MessageType('Storage') t.add_field(1, 'version', p.UVarintType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/Success.py b/src/trezor/messages/Success.py index f8c1c5ff5f..31012ee729 100644 --- a/src/trezor/messages/Success.py +++ b/src/trezor/messages/Success.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('Success') t.wire_type = 2 t.add_field(1, 'message', p.UnicodeType) diff --git a/src/trezor/messages/TransactionType.py b/src/trezor/messages/TransactionType.py index 3117dcfd7f..40c9e88c43 100644 --- a/src/trezor/messages/TransactionType.py +++ b/src/trezor/messages/TransactionType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .TxInputType import TxInputType from .TxOutputBinType import TxOutputBinType from .TxOutputType import TxOutputType diff --git a/src/trezor/messages/TxAck.py b/src/trezor/messages/TxAck.py index bad050aad6..c6bf85fcce 100644 --- a/src/trezor/messages/TxAck.py +++ b/src/trezor/messages/TxAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .TransactionType import TransactionType t = p.MessageType('TxAck') t.wire_type = 22 diff --git a/src/trezor/messages/TxInputType.py b/src/trezor/messages/TxInputType.py index 3bf6cbb612..a2374d6845 100644 --- a/src/trezor/messages/TxInputType.py +++ b/src/trezor/messages/TxInputType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .MultisigRedeemScriptType import MultisigRedeemScriptType t = p.MessageType('TxInputType') t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) diff --git a/src/trezor/messages/TxOutputBinType.py b/src/trezor/messages/TxOutputBinType.py index b0114df1cd..34c7489007 100644 --- a/src/trezor/messages/TxOutputBinType.py +++ b/src/trezor/messages/TxOutputBinType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('TxOutputBinType') t.add_field(1, 'amount', p.UVarintType, flags=p.FLAG_REQUIRED) t.add_field(2, 'script_pubkey', p.BytesType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/TxOutputType.py b/src/trezor/messages/TxOutputType.py index 0bf0465e09..07bc11cca9 100644 --- a/src/trezor/messages/TxOutputType.py +++ b/src/trezor/messages/TxOutputType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .MultisigRedeemScriptType import MultisigRedeemScriptType t = p.MessageType('TxOutputType') t.add_field(1, 'address', p.UnicodeType) diff --git a/src/trezor/messages/TxRequest.py b/src/trezor/messages/TxRequest.py index 2a21ffb48d..6ff92afe4a 100644 --- a/src/trezor/messages/TxRequest.py +++ b/src/trezor/messages/TxRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p from .TxRequestDetailsType import TxRequestDetailsType from .TxRequestSerializedType import TxRequestSerializedType t = p.MessageType('TxRequest') diff --git a/src/trezor/messages/TxRequestDetailsType.py b/src/trezor/messages/TxRequestDetailsType.py index 891f9b15b0..1a3be1e4f3 100644 --- a/src/trezor/messages/TxRequestDetailsType.py +++ b/src/trezor/messages/TxRequestDetailsType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('TxRequestDetailsType') t.add_field(1, 'request_index', p.UVarintType) t.add_field(2, 'tx_hash', p.BytesType) diff --git a/src/trezor/messages/TxRequestSerializedType.py b/src/trezor/messages/TxRequestSerializedType.py index 2b0ffd3b6d..701ad27010 100644 --- a/src/trezor/messages/TxRequestSerializedType.py +++ b/src/trezor/messages/TxRequestSerializedType.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('TxRequestSerializedType') t.add_field(1, 'signature_index', p.UVarintType) t.add_field(2, 'signature', p.BytesType) diff --git a/src/trezor/messages/TxSize.py b/src/trezor/messages/TxSize.py index 0cd520711b..06e43d2f8c 100644 --- a/src/trezor/messages/TxSize.py +++ b/src/trezor/messages/TxSize.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('TxSize') t.wire_type = 44 t.add_field(1, 'tx_size', p.UVarintType) diff --git a/src/trezor/messages/VerifyMessage.py b/src/trezor/messages/VerifyMessage.py index cb2360e3a6..9e7397389b 100644 --- a/src/trezor/messages/VerifyMessage.py +++ b/src/trezor/messages/VerifyMessage.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('VerifyMessage') t.wire_type = 39 t.add_field(1, 'address', p.UnicodeType) diff --git a/src/trezor/messages/WipeDevice.py b/src/trezor/messages/WipeDevice.py index 6f4acdace9..de8c1cc483 100644 --- a/src/trezor/messages/WipeDevice.py +++ b/src/trezor/messages/WipeDevice.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('WipeDevice') t.wire_type = 5 WipeDevice = t \ No newline at end of file diff --git a/src/trezor/messages/WordAck.py b/src/trezor/messages/WordAck.py index 5b9cd87629..5892fe8595 100644 --- a/src/trezor/messages/WordAck.py +++ b/src/trezor/messages/WordAck.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('WordAck') t.wire_type = 47 t.add_field(1, 'word', p.UnicodeType, flags=p.FLAG_REQUIRED) diff --git a/src/trezor/messages/WordRequest.py b/src/trezor/messages/WordRequest.py index 9188223343..73cd545cfe 100644 --- a/src/trezor/messages/WordRequest.py +++ b/src/trezor/messages/WordRequest.py @@ -1,5 +1,5 @@ # Automatically generated by pb2py -from protobuf import protobuf as p +import protobuf as p t = p.MessageType('WordRequest') t.wire_type = 46 WordRequest = t \ No newline at end of file diff --git a/src/trezor/wire/__init__.py b/src/trezor/wire/__init__.py index 444b38859e..0431cca3aa 100644 --- a/src/trezor/wire/__init__.py +++ b/src/trezor/wire/__init__.py @@ -1,4 +1,4 @@ -from protobuf.protobuf import build_protobuf_message +from protobuf import build_protobuf_message from trezor.loop import schedule_task, Future from trezor.crypto import random diff --git a/tools/pb2py b/tools/pb2py index 922022fab7..0287899a69 100755 --- a/tools/pb2py +++ b/tools/pb2py @@ -7,7 +7,7 @@ from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper def process_type(t, cls, msg_id, indexfile): - imports = ["from protobuf import protobuf as p", ] + imports = ["import protobuf as p", ] out = ["t = p.MessageType('%s')" % t, ]