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

Unified Diff: appengine/findit/crash/component_classifier.py

Issue 2414523002: [Findit] Reorganizing findit_for_*.py (Closed)
Patch Set: trying to fix some tests Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/crash/component_classifier.py
diff --git a/appengine/findit/crash/component_classifier.py b/appengine/findit/crash/component_classifier.py
index f607983018baf1ad177a58ffc7243ea3473e314c..12aa8211aa491f09da9ff1a51972b38d3c0feea9 100644
--- a/appengine/findit/crash/component_classifier.py
+++ b/appengine/findit/crash/component_classifier.py
@@ -6,7 +6,7 @@ from collections import namedtuple
import logging
import re
-from crash.classifier import Classifier
+from crash.occurrence import RankByOccurrence
# TODO(wrengr): write coverage tests the old version was lacking.
@@ -38,7 +38,7 @@ class Component(namedtuple('Component',
return self.function_regex.match(frame.function)
-class ComponentClassifier(Classifier):
+class ComponentClassifier(object):
"""Determines the component of a crash.
For example: ['Blink>DOM', 'Blink>HTML'].
@@ -90,4 +90,11 @@ class ComponentClassifier(Classifier):
Returns:
List of top 2 components.
"""
- return self._Classify(results, crash_stack, self.top_n, 2)
+ # If |results| are available, we use the components from there since
+ # they're more reliable than the ones from the |crash_stack|.
+ if results:
+ classes = map(self.GetClassFromResult, results[:self.top_n])
+ else:
+ classes = map(self.GetClassFromStackFrame, crash_stack[:self.top_n])
+
+ return RankByOccurrence(classes, 2)

Powered by Google App Engine
This is Rietveld 408576698