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

Side by Side Diff: appengine/findit/model/crash/crash_config.py

Issue 2338273006: [Findit] Factoring out the components, so they can classify themselves (Closed)
Patch Set: Created 4 years, 3 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
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 """Findit for crash (ClusterFuzz & Fracas/Chromecrash) configuration.""" 5 """Findit for crash (ClusterFuzz & Fracas/Chromecrash) configuration."""
6 6
7 import re 7 import re
8 8
9 from google.appengine.ext import ndb 9 from google.appengine.ext import ndb
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 def ClearCache(self): 86 def ClearCache(self):
87 self.cached_component_classifier = None 87 self.cached_component_classifier = None
88 88
89 @property 89 @property
90 def compiled_component_classifier(self): 90 def compiled_component_classifier(self):
91 """Returns the component classifier with all re patterns compiled.""" 91 """Returns the component classifier with all re patterns compiled."""
92 if self.cached_component_classifier is None and self.component_classifier: 92 if self.cached_component_classifier is None and self.component_classifier:
93 compiled_path_function_component = [] 93 compiled_path_function_component = []
94 for path, function, component in self.component_classifier[ 94 for path, function, component in self.component_classifier[
95 'path_function_component']: 95 'path_function_component']:
96 # TODO(wrengr): build Component objects here, rather than doing so later
stgao 2016/09/21 21:57:27 nit: end with dot like this.
wrengr 2016/09/27 22:00:40 Done.
96 compiled_path_function_component.append( 97 compiled_path_function_component.append(
97 [re.compile(path), 98 [re.compile(path),
98 re.compile(function) if function else None, 99 re.compile(function) if function else None,
99 component]) 100 component])
100 101
101 self.cached_component_classifier = { 102 self.cached_component_classifier = {
102 'top_n': self.component_classifier['top_n'], 103 'top_n': self.component_classifier['top_n'],
103 'path_function_component': compiled_path_function_component 104 'path_function_component': compiled_path_function_component
104 } 105 }
105 106
106 return self.cached_component_classifier 107 return self.cached_component_classifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698