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:
parent
f24cb943b0
commit
3a7bdf684a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user