Exemplo n.º 1
0
    def GetPrintStyle(self):
        """Gets an XmlStyle object for pretty printing a document of this type.

    Returns:
      An XML style object.
    """
        types = self.root_type.GetNodeTypes()
        return pretty_print_xml.XmlStyle(
            attribute_order={t: types[t].GetAttributes()
                             for t in types},
            required_attributes={
                t: types[t].GetRequiredAttributes()
                for t in types
            },
            tags_that_have_extra_newline={
                t: types[t].extra_newlines
                for t in types if types[t].extra_newlines
            },
            tags_that_dont_indent=[t for t in types if not types[t].indent],
            tags_that_allow_single_line=[
                t for t in types if types[t].single_line
            ],
            tags_alphabetization_rules={
                t: types[t].alphabetization
                for t in types if types[t].alphabetization
            })
Exemplo n.º 2
0
def GetPrintStyle():
    """Returns an XmlStyle object for pretty printing actions."""
    return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, REQUIRED_ATTRIBUTES,
                                     TAGS_THAT_HAVE_EXTRA_NEWLINE,
                                     TAGS_THAT_DONT_INDENT,
                                     TAGS_THAT_ALLOW_SINGLE_LINE,
                                     TAGS_ALPHABETIZATION_RULES)
Exemplo n.º 3
0
 def GetPrintStyle(self):
     types = self.root_type.GetNodeTypes()
     return pretty_print_xml.XmlStyle(
         {t: types[t].GetAttributes()
          for t in types}, {
              t: types[t].extra_newlines
              for t in types if types[t].extra_newlines
          }, [t for t in types if types[t].dont_indent],
         [t for t in types if types[t].single_line], {})
Exemplo n.º 4
0
def GetPrintStyle():
    """Returns an XmlStyle object for pretty printing histograms."""
    return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER,
                                     TAGS_THAT_HAVE_EXTRA_NEWLINE,
                                     TAGS_THAT_DONT_INDENT,
                                     TAGS_THAT_ALLOW_SINGLE_LINE)