def _generate_enumerated_subtypes_tag_mapping(self, ns, data_type):
assert data_type.has_enumerated_subtypes()<EOL>tag_to_subtype_items = []<EOL>for tags, subtype in data_type.get_all_subtypes_with_tags():<EOL><INDENT>tag_to_subtype_items.append("<STR_LIT>".format(<EOL>tags,<EOL>generate_validator_constructor(ns, subtype)))<EOL><DEDENT>self.generate_multiline_list(<EOL>tag_to_subtype_items,<EOL>before='<STR_LIT>'.format(data_type.name),<EOL>delim=('<STR_LIT:{>', '<STR_LIT:}>'),<EOL>compact=False)<EOL>items = []<EOL>for tag, subtype in data_type.get_all_subtypes_with_tags():<EOL><INDENT>items.append("<STR_LIT>".format(<EOL>fmt_class(subtype.name),<EOL>tag,<EOL>generate_validator_constructor(ns, subtype)))<EOL><DEDENT>self.generate_multiline_list(<EOL>items,<EOL>before='<STR_LIT>'.format(data_type.name),<EOL>delim=('<STR_LIT:{>', '<STR_LIT:}>'),<EOL>compact=False)<EOL>self.emit('<STR_LIT>'.format(<EOL>data_type.name, data_type.is_catch_all()))<EOL>self.emit()<EOL>
Generates attributes needed for serializing and deserializing structs
with enumerated subtypes. These assignments are made after all the
Python class definitions to ensure that all references exist.