messages_map: Fix Flake8 warnings

pull/25/head
Saleem Rashid 7 years ago committed by Pavol Rusnak
parent 88230e33c4
commit 69356e5f56

@ -1,7 +1,10 @@
#!/usr/bin/env python
from collections import defaultdict
from messages_pb2 import MessageType
from types_pb2 import wire_in, wire_out, wire_debug_in, wire_debug_out, wire_tiny, wire_bootloader
from types_pb2 import wire_in, wire_out
from types_pb2 import wire_debug_in, wire_debug_out
from types_pb2 import wire_bootloader, wire_tiny
# len("MessageType_MessageType_") - len("_fields") == 17
TEMPLATE = "\t{{ {type} {dir} {msg_id:46} {fields:29} {process_func} }},"
@ -13,6 +16,7 @@ LABELS = {
wire_debug_out: "debug out messages",
}
def handle_message(message, extension):
name = message.name
short_name = name.split("MessageType_", 1).pop()
@ -32,15 +36,22 @@ def handle_message(message, extension):
if tiny:
return '\t// Message %s is used in tiny mode' % short_name
if direction == "i":
process_func = "(void (*)(void *)) fsm_msg%s" % short_name
else:
process_func = "0"
return TEMPLATE.format(
type="'%c'," % interface,
dir="'%c'," % direction,
msg_id="MessageType_%s," % name,
fields="%s_fields," % short_name,
process_func = "(void (*)(void *)) fsm_msg%s" % short_name if direction == "i" else "0"
process_func=process_func,
)
print('\t// This file is automatically generated by messages_map.py -- DO NOT EDIT!')
print("\t// This file is automatically generated"
"by messages_map.py -- DO NOT EDIT!")
messages = defaultdict(list)

Loading…
Cancel
Save