Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/bisect_results.py

Issue 1044543002: Lint bisect-related modules; obey pylint. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Rebased Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/api.py ('k') | scripts/slave/recipe_modules/auto_bisect/bisector.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698