| 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 from libs.gitiles.commit_util import DistanceBetweenLineRanges | 7 from libs.gitiles.commit_util import DistanceBetweenLineRanges |
| 8 | 8 |
| 9 | 9 |
| 10 # TODO(wrengr): we should change things to use integers with None as | 10 # TODO(wrengr): we should change things to use integers with None as |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 raise TypeError( | 51 raise TypeError( |
| 52 'In the ``confidence`` argument to the Result constructor, ' | 52 'In the ``confidence`` argument to the Result constructor, ' |
| 53 'expected a number or None, but got a %s object instead.' | 53 'expected a number or None, but got a %s object instead.' |
| 54 % confidence.__class__.__name__) | 54 % confidence.__class__.__name__) |
| 55 self.changelog = changelog | 55 self.changelog = changelog |
| 56 self.dep_path = dep_path | 56 self.dep_path = dep_path |
| 57 self.confidence = None if confidence is None else float(confidence) | 57 self.confidence = None if confidence is None else float(confidence) |
| 58 self.reasons = reasons | 58 self.reasons = reasons |
| 59 self.changed_files = changed_files | 59 self.changed_files = changed_files |
| 60 | 60 |
| 61 # TODO(katesonia): These file_to_* should be deprecated once we deprecate |
| 62 # the scorer-based changelist_classifier. |
| 61 # TODO(wrengr): (a) make these two fields private/readonly | 63 # TODO(wrengr): (a) make these two fields private/readonly |
| 62 # TODO(wrengr): (b) zip them together. | 64 # TODO(wrengr): (b) zip them together. |
| 63 # TODO(wrengr): (c) move them to the relevant features instead. | 65 # TODO(wrengr): (c) move them to the relevant features instead. |
| 64 self.file_to_stack_infos = {} | 66 self.file_to_stack_infos = {} |
| 65 self.file_to_analysis_info = {} | 67 self.file_to_analysis_info = {} |
| 66 | 68 |
| 67 def ToDict(self): | 69 def ToDict(self): |
| 68 return { | 70 return { |
| 69 'url': self.changelog.commit_url, | 71 'url': self.changelog.commit_url, |
| 70 'review_url': self.changelog.code_review_url, | 72 'review_url': self.changelog.code_review_url, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if self._ignore_cls and changelog.revision in self._ignore_cls: | 177 if self._ignore_cls and changelog.revision in self._ignore_cls: |
| 176 continue | 178 continue |
| 177 | 179 |
| 178 try: | 180 try: |
| 179 suspect = self[changelog.revision] | 181 suspect = self[changelog.revision] |
| 180 except KeyError: | 182 except KeyError: |
| 181 suspect = Suspect(changelog, dep_path) | 183 suspect = Suspect(changelog, dep_path) |
| 182 self[changelog.revision] = suspect | 184 self[changelog.revision] = suspect |
| 183 | 185 |
| 184 suspect._UpdateSuspect(file_path, stack_infos, blame) | 186 suspect._UpdateSuspect(file_path, stack_infos, blame) |
| OLD | NEW |