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

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

Issue 2562623004: Making CallStack immutable, so it can be hashable (Closed)
Patch Set: Addressing nits Created 4 years 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
« no previous file with comments | « appengine/findit/crash/predator.py ('k') | appengine/findit/crash/stacktrace.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import logging 5 import logging
6 6
7 from crash.occurrence import RankByOccurrence 7 from crash.occurrence import RankByOccurrence
8 from crash.type_enums import CallStackLanguageType 8 from crash.type_enums import CallStackLanguageType
9 from model.crash.crash_config import CrashConfig 9 from model.crash.crash_config import CrashConfig
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return (weight, index) 100 return (weight, index)
101 101
102 rank_function = _RankFunctionForJava 102 rank_function = _RankFunctionForJava
103 103
104 top_n_frames = self.project_classifier_config['top_n'] 104 top_n_frames = self.project_classifier_config['top_n']
105 # If ``results`` are available, we use the projects from there since 105 # If ``results`` are available, we use the projects from there since
106 # they're more reliable than the ones from the ``crash_stack``. 106 # they're more reliable than the ones from the ``crash_stack``.
107 if results: 107 if results:
108 classes = map(self.GetClassFromResult, results[:top_n_frames]) 108 classes = map(self.GetClassFromResult, results[:top_n_frames])
109 else: 109 else:
110 classes = map(self.GetClassFromStackFrame, crash_stack[:top_n_frames]) 110 classes = map(self.GetClassFromStackFrame,
111 crash_stack.frames[:top_n_frames])
111 112
112 # Since we're only going to return the highest-ranked class, might 113 # Since we're only going to return the highest-ranked class, might
113 # as well set ``max_classes`` to 1. 114 # as well set ``max_classes`` to 1.
114 projects = RankByOccurrence(classes, 1, rank_function=rank_function) 115 projects = RankByOccurrence(classes, 1, rank_function=rank_function)
115 116
116 if projects: 117 if projects:
117 return projects[0] 118 return projects[0]
118 119
119 logging.warning('ProjectClassifier.Classify: no projects found.') 120 logging.warning('ProjectClassifier.Classify: no projects found.')
120 return '' 121 return ''
OLDNEW
« no previous file with comments | « appengine/findit/crash/predator.py ('k') | appengine/findit/crash/stacktrace.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698