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

Side by Side Diff: appengine/findit/crash/results.py

Issue 2455053004: Moving ScheduleNewAnalysis to break the cycle (Closed)
Patch Set: rebase Created 4 years, 1 month 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 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 # TODO(http://crbug.com/644476): this class needs a better name. 7 # TODO(http://crbug.com/644476): this class needs a better name.
8 class AnalysisInfo(namedtuple('AnalysisInfo', 8 class AnalysisInfo(namedtuple('AnalysisInfo',
9 ['min_distance', 'min_distance_frame'])): 9 ['min_distance', 'min_distance_frame'])):
10 __slots__ = () 10 __slots__ = ()
11 11
12 12
13 # TODO(http://crbug.com/644476): this class needs a better name. 13 # TODO(http://crbug.com/644476): this class needs a better name.
14 # TODO(wrengr): subclass namedtuple, so most things are immutable. 14 # TODO(http://crbug.com/661822): convert this into a namedtuple.
15 class Result(object): 15 class Result(object):
16 """Represents findit culprit result.""" 16 """Represents findit culprit result."""
17 17
18 def __init__(self, changelog, dep_path, 18 def __init__(self, changelog, dep_path,
19 confidence=None, reasons=None, changed_files=None): 19 confidence=None, reasons=None, changed_files=None):
20 self.changelog = changelog 20 self.changelog = changelog
21 self.dep_path = dep_path 21 self.dep_path = dep_path
22 self.confidence = confidence 22 self.confidence = confidence
23 self.reasons = reasons 23 self.reasons = reasons
24 self.changed_files = changed_files 24 self.changed_files = changed_files
25 25
26 # TODO(wrengr): (a) make these two fields private/readonly 26 # TODO(wrengr): (a) make these two fields private/readonly
27 # TODO(wrengr): (b) zip them together. 27 # TODO(wrengr): (b) zip them together.
28 # TODO(wrengr): replace "stack_info" pair with a namedtuple. 28 # TODO(http://crbug.com/661822): change stack_info pair to a namedtuple.
29 self.file_to_stack_infos = {} 29 self.file_to_stack_infos = {}
30 # TODO(wrengr): replace "analysis_info" dict with a namedtuple.
31 self.file_to_analysis_info = {} 30 self.file_to_analysis_info = {}
32 31
33 def ToDict(self): 32 def ToDict(self):
34 return { 33 return {
35 'url': self.changelog.commit_url, 34 'url': self.changelog.commit_url,
36 'review_url': self.changelog.code_review_url, 35 'review_url': self.changelog.code_review_url,
37 'revision': self.changelog.revision, 36 'revision': self.changelog.revision,
38 'project_path': self.dep_path, 37 'project_path': self.dep_path,
39 'author': self.changelog.author_email, 38 'author': self.changelog.author_email,
40 'time': str(self.changelog.author_time), 39 'time': str(self.changelog.author_time),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 """ 161 """
163 for changelog in changelogs: 162 for changelog in changelogs:
164 if self._ignore_cls and changelog.revision in self._ignore_cls: 163 if self._ignore_cls and changelog.revision in self._ignore_cls:
165 continue 164 continue
166 165
167 if changelog.revision not in self: 166 if changelog.revision not in self:
168 self[changelog.revision] = MatchResult(changelog, dep_path) 167 self[changelog.revision] = MatchResult(changelog, dep_path)
169 168
170 match_result = self[changelog.revision] 169 match_result = self[changelog.revision]
171 match_result.Update(file_path, stack_infos, blame) 170 match_result.Update(file_path, stack_infos, blame)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698