Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __add_definition(self, local_type, extended):
endian = self.__data[self.__offset+2] & 0x1
global_type = unpack('<>'[endian]+'H', self.__data[self.__offset+3:self.__offset+5])[0]
message = self.__messages.number_to_message(global_type)
identity = Identity(message.name, self.__defn_counter)
n_fields = self.__data[self.__offset+5]
fields = tuple(self.__fields(self.__field,self.__offset+6, n_fields, message))
offset = 6 + n_fields * 3
if extended:
n_dev_fields = self.__data[self.__offset+offset]
dev_fields = tuple(self.__fields(self.__dev_field, self.__offset+offset+1, n_dev_fields))
offset += 1 + n_dev_fields * 3
else:
dev_fields = ()
self.__definitions[local_type] = Definition(self.__log, identity, endian, message, fields, dev_fields)
return offset