Chromium Code Reviews| 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 from collections import namedtuple | 5 from collections import namedtuple |
| 6 | 6 |
| 7 | 7 |
| 8 class Culprit(namedtuple('Culprit', | 8 class Culprit(namedtuple('Culprit', |
| 9 ['project', 'components', 'cls', 'regression_range', 'algorithm'])): | 9 ['project', 'components', 'cls', 'regression_range', 'algorithm'])): |
| 10 """The result of successfully identifying the culprit of a crash report. | 10 """The result of successfully identifying the culprit of a crash report. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 """ | 91 """ |
| 92 # TODO(wrengr): will this auto-dropping of unnecessary fields cause | 92 # TODO(wrengr): will this auto-dropping of unnecessary fields cause |
| 93 # any issues for JSON serialization? | 93 # any issues for JSON serialization? |
| 94 result = {} | 94 result = {} |
| 95 result['found'] = ( | 95 result['found'] = ( |
| 96 bool(self.project) or | 96 bool(self.project) or |
| 97 bool(self.components) or | 97 bool(self.components) or |
| 98 bool(self.cls) or | 98 bool(self.cls) or |
| 99 bool(self.regression_range)) | 99 bool(self.regression_range)) |
| 100 if self.regression_range: | 100 if self.regression_range: |
| 101 result['regression_range'] = self.regression_range | 101 result['regression_range'] = self.regression_range |
|
wrengr
2016/11/01 22:07:52
We should copy the self.regression_range into a li
Sharu Jiang
2016/11/11 23:10:26
Done in rebase.
| |
| 102 if self.project is not None: | 102 if self.project: |
| 103 result['suspected_project'] = self.project | 103 result['suspected_project'] = self.project |
| 104 if self.components is not None: | 104 if self.components: |
| 105 result['suspected_components'] = self.components | 105 result['suspected_components'] = self.components |
| 106 if self.cls is not None: | 106 if self.cls: |
| 107 result['suspected_cls'] = [cl.ToDict() for cl in self.cls] | 107 result['suspected_cls'] = [cl.ToDict() for cl in self.cls] |
| 108 | 108 |
| 109 tags = { | 109 tags = { |
| 110 'found_suspects': bool(self.cls), | 110 'found_suspects': bool(self.cls), |
| 111 'has_regression_range': bool(self.regression_range), | 111 'has_regression_range': bool(self.regression_range), |
| 112 'found_project': bool(self.project), | 112 'found_project': bool(self.project), |
| 113 'found_components': bool(self.components), | 113 'found_components': bool(self.components), |
| 114 'solution': self.algorithm, | 114 'solution': self.algorithm, |
| 115 } | 115 } |
| 116 | 116 |
| 117 return result, tags | 117 return result, tags |
| OLD | NEW |