def linearize_data_types(self):<EOL>
linearized_data_types = []<EOL>seen_data_types = set()  <EOL>def add_data_type(data_type):<EOL><INDENT>if data_type in seen_data_types:<EOL><INDENT>return<EOL><DEDENT>elif data_type.namespace != self:<EOL><INDENT>return<EOL><DEDENT>if is_composite_type(data_type) and data_type.parent_type:<EOL><INDENT>add_data_type(data_type.parent_type)<EOL><DEDENT>linearized_data_types.append(data_type)<EOL>seen_data_types.add(data_type)<EOL><DEDENT>for data_type in self.data_types:<EOL><INDENT>add_data_type(data_type)<EOL><DEDENT>return linearized_data_types<EOL>
Returns a list of all data types used in the namespace. Because the
inheritance of data types can be modeled as a DAG, the list will be a
linearization of the DAG. It's ideal to generate data types in this
order so that composite types that reference other composite types are
defined in the correct order.