Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def header_defn(log, types, messages):
message = messages.number_to_message(HEADER_GLOBAL_TYPE)
return Definition(log, Identity(message.name, Counter()), LITTLE, message,
[Field(log, field[1] * types.profile_to_type(field[2]).size,
message.number_to_field(n),
types.profile_to_type(field[2]))
for n, field in enumerate(HEADER_FIELDS)],
(),
{'header_size'}) # this needed as reference for optional field logic
def __dev_field(self, data):
number, size, developer_index = data
field = self.__dev_fields[developer_index][number]
return Field(self.__log, size, field, field.type)
def __field(self, data, message):
number, size, base = data
try:
field = message.number_to_field(number)
except KeyError:
field = None
base_type = self.__types.base_types[base & 0xf]
return Field(self.__log, size, field, base_type)