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 # Import the metrics/common module for pretty print xml. |
11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) | 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) |
12 import pretty_print_xml | 12 import pretty_print_xml |
13 | 13 |
14 # Desired order for tag and tag attributes. The *_ATTRIBUTE_ORDER maps are also | 14 # Desired order for tag and tag attributes. The *_ATTRIBUTE_ORDER maps are also |
15 # used to determine the validity of tag names. | 15 # used to determine the validity of tag names. |
16 # { tag_name: [attribute_name, ...] } | 16 # { tag_name: [attribute_name, ...] } |
17 ATTRIBUTE_ORDER = { | 17 ATTRIBUTE_ORDER = { |
18 'affected-histogram': ['name'], | 18 'affected-histogram': ['name'], |
19 'details': [], | 19 'details': [], |
20 'enum': ['name', 'type'], | 20 'enum': ['name'], |
21 'enums': [], | 21 'enums': [], |
22 'histogram': ['base', 'name', 'enum', 'units'], | 22 'histogram': ['base', 'name', 'enum', 'units'], |
23 'histogram-configuration': ['logsource'], | 23 'histogram-configuration': ['logsource'], |
24 'histogram_suffixes': ['name', 'separator', 'ordering'], | 24 'histogram_suffixes': ['name', 'separator', 'ordering'], |
25 'histogram_suffixes_list': [], | 25 'histogram_suffixes_list': [], |
26 'histograms': [], | 26 'histograms': [], |
27 'int': ['value', 'label'], | 27 'int': ['value', 'label'], |
28 'obsolete': [], | 28 'obsolete': [], |
29 'owner': [], | 29 'owner': [], |
30 'suffix': ['base', 'name', 'label'], | 30 'suffix': ['base', 'name', 'label'], |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 | 80 |
81 def GetPrintStyle(): | 81 def GetPrintStyle(): |
82 """Returns an XmlStyle object for pretty printing histograms.""" | 82 """Returns an XmlStyle object for pretty printing histograms.""" |
83 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, | 83 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, |
84 REQUIRED_ATTRIBUTES, | 84 REQUIRED_ATTRIBUTES, |
85 TAGS_THAT_HAVE_EXTRA_NEWLINE, | 85 TAGS_THAT_HAVE_EXTRA_NEWLINE, |
86 TAGS_THAT_DONT_INDENT, | 86 TAGS_THAT_DONT_INDENT, |
87 TAGS_THAT_ALLOW_SINGLE_LINE, | 87 TAGS_THAT_ALLOW_SINGLE_LINE, |
88 TAGS_ALPHABETIZATION_RULES) | 88 TAGS_ALPHABETIZATION_RULES) |
OLD | NEW |