OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 collections | 5 import collections |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import traceback | 8 import traceback |
9 | 9 |
10 from google.appengine.api import taskqueue | 10 from google.appengine.api import taskqueue |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 For every pair of adjacent Changes, compare their results as probability | 242 For every pair of adjacent Changes, compare their results as probability |
243 distributions. If the results are different, find the midpoint of the | 243 distributions. If the results are different, find the midpoint of the |
244 Changes and add it to the Job. | 244 Changes and add it to the Job. |
245 | 245 |
246 The midpoint can only be added if the second Change represents a commit that | 246 The midpoint can only be added if the second Change represents a commit that |
247 comes after the first Change. Otherwise, this method won't explore further. | 247 comes after the first Change. Otherwise, this method won't explore further. |
248 For example, if Change A is repo@abc, and Change B is repo@abc + patch, | 248 For example, if Change A is repo@abc, and Change B is repo@abc + patch, |
249 there's no way to pick additional Changes to try. | 249 there's no way to pick additional Changes to try. |
250 """ | 250 """ |
251 # This loop adds Changes to the _changes list while looping through it. | 251 # This loop adds Changes to the _changes list while looping through it. |
| 252 # The Change insertion simultaneously uses and modifies the list indices. |
252 # However, the loop index goes in reverse order and Changes are only added | 253 # However, the loop index goes in reverse order and Changes are only added |
253 # after the loop index, so the loop never encounters the modified items. | 254 # after the loop index, so the loop never encounters the modified items. |
254 for index, change_b in reversed(tuple(self.Differences())): | 255 for index, change_b in reversed(tuple(self.Differences())): |
255 change_a = self._changes[index - 1] | 256 change_a = self._changes[index - 1] |
256 | 257 |
257 try: | 258 try: |
258 midpoint = change_module.Change.Midpoint(change_a, change_b) | 259 midpoint = change_module.Change.Midpoint(change_a, change_b) |
259 except change_module.NonLinearError: | 260 except change_module.NonLinearError: |
260 continue | 261 continue |
261 | 262 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 387 |
387 try: | 388 try: |
388 p_value = mann_whitney_u.MannWhitneyU(values_a, values_b) | 389 p_value = mann_whitney_u.MannWhitneyU(values_a, values_b) |
389 except ValueError: | 390 except ValueError: |
390 return _UNKNOWN | 391 return _UNKNOWN |
391 | 392 |
392 if p_value < _SIGNIFICANCE_LEVEL: | 393 if p_value < _SIGNIFICANCE_LEVEL: |
393 return _DIFFERENT | 394 return _DIFFERENT |
394 else: | 395 else: |
395 return _UNKNOWN | 396 return _UNKNOWN |
OLD | NEW |