Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse(self):
self.enums = []
self.messages = []
self.extensions = []
if self.fdesc.package:
base_name = Names(self.fdesc.package.split('.'))
else:
base_name = Names()
for enum in self.fdesc.enum_type:
enum_options = get_nanopb_suboptions(enum, self.file_options, base_name + enum.name)
self.enums.append(Enum(base_name, enum, enum_options))
for names, message in iterate_messages(self.fdesc, base_name):
message_options = get_nanopb_suboptions(message, self.file_options, names)
if message_options.skip_message:
continue
self.messages.append(Message(names, message, message_options))
for enum in message.enum_type:
enum_options = get_nanopb_suboptions(enum, message_options, names + enum.name)
self.enums.append(Enum(names, enum, enum_options))
for names, extension in iterate_extensions(self.fdesc, base_name):
field_options = get_nanopb_suboptions(extension, self.file_options, names + extension.name)
if field_options.type != nanopb_pb2.FT_IGNORE:
self.extensions.append(ExtensionField(names, extension, field_options))
base_name = Names()
for enum in self.fdesc.enum_type:
enum_options = get_nanopb_suboptions(enum, self.file_options, base_name + enum.name)
self.enums.append(Enum(base_name, enum, enum_options))
for names, message in iterate_messages(self.fdesc, base_name):
message_options = get_nanopb_suboptions(message, self.file_options, names)
if message_options.skip_message:
continue
self.messages.append(Message(names, message, message_options))
for enum in message.enum_type:
enum_options = get_nanopb_suboptions(enum, message_options, names + enum.name)
self.enums.append(Enum(names, enum, enum_options))
for names, extension in iterate_extensions(self.fdesc, base_name):
field_options = get_nanopb_suboptions(extension, self.file_options, names + extension.name)
if field_options.type != nanopb_pb2.FT_IGNORE:
self.extensions.append(ExtensionField(names, extension, field_options))