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

Side by Side Diff: appengine/findit/crash/scorers/scorer.py

Issue 2707603002: [Predator] Generate all changelogs in regression ranges instead of only matched changelogs (Closed)
Patch Set: . Created 3 years, 10 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
(Empty)
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
3 # found in the LICENSE file.
4
5 """Interface of scorers to score and reason Result.
6
7 A Scorer represents a heuristic rule to score a culprit cl result.
8 """
9
10 import logging
11
12
13 class Scorer(object): # pragma: no cover.
14
15 def GetMetric(self, result):
16 raise NotImplementedError()
17
18 def Score(self, metric):
19 """Scores the result based on extracted metric."""
20 raise NotImplementedError()
21
22 def Reason(self, metric, score):
23 """Gives the reason of this score."""
24 raise NotImplementedError()
25
26 def ChangedFiles(self, result, score):
27 """Returns the changed files info dict."""
28 raise NotImplementedError()
29
30 def __call__(self, result):
31 """Returns score and reason of this result."""
32 metric = self.GetMetric(result)
33 if metric is None:
34 logging.warning('Cannot get needed metric of result %s for scorer %s',
35 repr(result.ToDict()), self.name)
36 return 0, ''
37
38 score = self.Score(metric)
39 reason = self.Reason(metric, score)
40 changed_files = self.ChangedFiles(result, score)
41 return score, reason, changed_files
42
43 @property
44 def name(self):
45 return self.__class__.__name__
OLDNEW
« no previous file with comments | « appengine/findit/crash/scorers/min_distance.py ('k') | appengine/findit/crash/scorers/test/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698