OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import json | 5 import json |
6 import re | 6 import re |
7 | 7 |
8 # The perf dashboard looks for a string like "Estimated Confidence: 95%" | 8 # The perf dashboard looks for a string like "Estimated Confidence: 95%" |
9 # to decide whether or not to cc the author(s). If you change this, please | 9 # to decide whether or not to cc the author(s). If you change this, please |
10 # update the perf dashboard as well. | 10 # update the perf dashboard as well. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 _NO_CONFIDENCE_ABORT_REASON = ( | 93 _NO_CONFIDENCE_ABORT_REASON = ( |
94 'The metric values for the initial "good" and "bad" revisions ' | 94 'The metric values for the initial "good" and "bad" revisions ' |
95 'do not represent a clear regression.') | 95 'do not represent a clear regression.') |
96 | 96 |
97 _DIRECTION_OF_IMPROVEMENT_ABORT_REASON = ( | 97 _DIRECTION_OF_IMPROVEMENT_ABORT_REASON = ( |
98 'The metric values for the initial "good" and "bad" revisions match the ' | 98 'The metric values for the initial "good" and "bad" revisions match the ' |
99 'expected direction of improvement. Thus, likely represent an improvement ' | 99 'expected direction of improvement. Thus, likely represent an improvement ' |
100 'and not a regression.') | 100 'and not a regression.') |
101 | 101 |
| 102 |
102 class BisectResults(object): | 103 class BisectResults(object): |
103 def __init__(self, bisector): | 104 def __init__(self, bisector): |
104 """Create a new results object from a finished bisect job.""" | 105 """Create a new results object from a finished bisect job.""" |
105 if not bisector.bisect_over: | 106 if not bisector.bisect_over: |
106 raise ValueError( | 107 raise ValueError( |
107 'Invalid parameter, the bisect must be over by the time the ' | 108 'Invalid parameter, the bisect must be over by the time the ' |
108 'BisectResults constructor is called') # pragma: no cover | 109 'BisectResults constructor is called') # pragma: no cover |
109 self._bisector = bisector | 110 self._bisector = bisector |
110 self._gather_results() | 111 self._gather_results() |
111 | 112 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 234 |
234 This function was ripped off directly from somewhere in skia. It is | 235 This function was ripped off directly from somewhere in skia. It is |
235 inefficient and so, should be avoided for large data sets. | 236 inefficient and so, should be avoided for large data sets. |
236 | 237 |
237 Args: | 238 Args: |
238 data (list): A list of lists of strings containing the data to tabulate. It | 239 data (list): A list of lists of strings containing the data to tabulate. It |
239 is expected to be rectangular. | 240 is expected to be rectangular. |
240 | 241 |
241 Returns: A multi-line string containing the data arranged in a tabular manner. | 242 Returns: A multi-line string containing the data arranged in a tabular manner. |
242 """ | 243 """ |
243 | |
244 result = '' | 244 result = '' |
245 column_widths = [0] * len(data[0]) | 245 column_widths = [0] * len(data[0]) |
246 for line in data: | 246 for line in data: |
247 column_widths = [max(longest_len, len(prop)) for | 247 column_widths = [max(longest_len, len(prop)) for |
248 longest_len, prop in zip(column_widths, line)] | 248 longest_len, prop in zip(column_widths, line)] |
249 for line in data: | 249 for line in data: |
250 for prop, width in zip(line, column_widths): | 250 for prop, width in zip(line, column_widths): |
251 result += prop.ljust(width + 1) | 251 result += prop.ljust(width + 1) |
252 result += '\n' | 252 result += '\n' |
253 return result | 253 return result |
254 | 254 |
OLD | NEW |