| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Holds the constants for pretty printing histograms.xml.""" | 5 """Holds the constants for pretty printing histograms.xml.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 # Import the metrics/common module for pretty print xml. | 10 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # tools/metrics |
| 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) | 11 from common import pretty_print_xml |
| 12 import pretty_print_xml | |
| 13 | 12 |
| 14 # Desired order for tag attributes; attributes listed here will appear first, | 13 # Desired order for tag attributes; attributes listed here will appear first, |
| 15 # and in the same order as in these lists. | 14 # and in the same order as in these lists. |
| 16 # { tag_name: [attribute_name, ...] } | 15 # { tag_name: [attribute_name, ...] } |
| 17 ATTRIBUTE_ORDER = { | 16 ATTRIBUTE_ORDER = { |
| 18 'enum': ['name', 'type'], | 17 'enum': ['name', 'type'], |
| 19 'histogram': ['name', 'enum', 'units'], | 18 'histogram': ['name', 'enum', 'units'], |
| 20 'int': ['value', 'label'], | 19 'int': ['value', 'label'], |
| 21 'histogram_suffixes': ['name', 'separator', 'ordering'], | 20 'histogram_suffixes': ['name', 'separator', 'ordering'], |
| 22 'suffix': ['name', 'label'], | 21 'suffix': ['name', 'label'], |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 'owner', | 50 'owner', |
| 52 ] | 51 ] |
| 53 | 52 |
| 54 | 53 |
| 55 def GetPrintStyle(): | 54 def GetPrintStyle(): |
| 56 """Returns an XmlStyle object for pretty printing histograms.""" | 55 """Returns an XmlStyle object for pretty printing histograms.""" |
| 57 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, | 56 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, |
| 58 TAGS_THAT_HAVE_EXTRA_NEWLINE, | 57 TAGS_THAT_HAVE_EXTRA_NEWLINE, |
| 59 TAGS_THAT_DONT_INDENT, | 58 TAGS_THAT_DONT_INDENT, |
| 60 TAGS_THAT_ALLOW_SINGLE_LINE) | 59 TAGS_THAT_ALLOW_SINGLE_LINE) |
| OLD | NEW |