| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Pretty-prints the histograms.xml file, alphabetizing tags, wrapping text | 6 """Pretty-prints the histograms.xml file, alphabetizing tags, wrapping text |
| 7 at 80 chars, enforcing standard attribute ordering, and standardizing | 7 at 80 chars, enforcing standard attribute ordering, and standardizing |
| 8 indentation. | 8 indentation. |
| 9 | 9 |
| 10 This is quite a bit more complicated than just calling tree.toprettyxml(); | 10 This is quite a bit more complicated than just calling tree.toprettyxml(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 import presubmit_util | 25 import presubmit_util |
| 26 | 26 |
| 27 import print_style | 27 import print_style |
| 28 | 28 |
| 29 | 29 |
| 30 class Error(Exception): | 30 class Error(Exception): |
| 31 pass | 31 pass |
| 32 | 32 |
| 33 | 33 |
| 34 UNIT_REWRITES = { | 34 UNIT_REWRITES = { |
| 35 'microsecond': 'microseconds', |
| 36 'us': 'microseconds', |
| 35 'millisecond': 'ms', | 37 'millisecond': 'ms', |
| 36 'milliseconds': 'ms', | 38 'milliseconds': 'ms', |
| 37 'kb': 'KB', | 39 'kb': 'KB', |
| 38 'kB': 'KB', | 40 'kB': 'KB', |
| 39 'kilobytes': 'KB', | 41 'kilobytes': 'KB', |
| 40 'kbits/s': 'kbps', | 42 'kbits/s': 'kbps', |
| 41 'percent': '%', | 43 'percent': '%', |
| 42 'Percent': '%', | 44 'Percent': '%', |
| 43 'percentage': '%', | 45 'percentage': '%', |
| 44 } | 46 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return print_style.GetPrintStyle().PrettyPrintXml(tree) | 79 return print_style.GetPrintStyle().PrettyPrintXml(tree) |
| 78 | 80 |
| 79 | 81 |
| 80 def main(): | 82 def main(): |
| 81 presubmit_util.DoPresubmitMain(sys.argv, 'histograms.xml', | 83 presubmit_util.DoPresubmitMain(sys.argv, 'histograms.xml', |
| 82 'histograms.before.pretty-print.xml', | 84 'histograms.before.pretty-print.xml', |
| 83 'pretty_print.py', PrettyPrint) | 85 'pretty_print.py', PrettyPrint) |
| 84 | 86 |
| 85 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 86 main() | 88 main() |
| OLD | NEW |