1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

protob: make isort happy correctly

This commit is contained in:
Pavol Rusnak 2018-08-03 19:11:02 +02:00
parent f24cb943b0
commit 3a7bdf684a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -189,6 +189,8 @@ class Descriptor:
if field.orig.type == field.orig.TYPE_MESSAGE
)
if len(imports) > 0:
yield "" # make isort happy
for name in sorted(imports):
yield self.create_message_import(name)
@ -215,19 +217,19 @@ class Descriptor:
# "from .. import protobuf as p"
yield self.protobuf_import + " as p"
yield ""
fields = [self.parse_field(field) for field in message.field]
yield from self.process_message_imports(fields)
if any(field.repeated for field in fields):
yield ""
yield "if __debug__:"
yield " try:"
yield " from typing import List"
yield " except ImportError:"
yield " List = None # type: ignore"
yield from self.process_message_imports(fields)
yield ""
yield ""
yield "class {}(p.MessageType):".format(message.name)