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

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

Issue 2518663002: Converting various classes to namedtuples (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/crash/results.py
diff --git a/appengine/findit/crash/results.py b/appengine/findit/crash/results.py
index 066941e37dc4530799bb025cb466c49b81894599..4c270e9f2ebb8291bc9627cb4214c9484c09dabb 100644
--- a/appengine/findit/crash/results.py
+++ b/appengine/findit/crash/results.py
@@ -10,8 +10,17 @@ class AnalysisInfo(namedtuple('AnalysisInfo',
__slots__ = ()
+# TODO(wrengr): it's not clear exactly what \"priority\" means nor why
+# it's necessary, given that every use in this file discards it.
Sharu Jiang 2016/11/21 23:31:57 The priority is priority of callstack, this is con
wrengr 2016/11/22 18:33:40 That's what I was thinking. But since nothing here
Sharu Jiang 2016/11/22 18:53:51 For Fracas/Crasas, this is not needed since they o
# TODO(http://crbug.com/644476): this class needs a better name.
-# TODO(http://crbug.com/661822): convert this into a namedtuple.
+class StackInfo(namedtuple('StackInfo', ['frame', 'priority'])):
+ __slots__ = ()
+
+
+# TODO(http://crbug.com/644476): this class needs a better name.
+# TODO(http://crbug.com/661822): maybe convert this into a namedtuple? We
+# can do it here, but then the ``Update`` method on the subclass will be
+# busted. Do we actually need/want that method? If so, to what end?
Sharu Jiang 2016/11/21 23:31:57 We are currently matching file changed by changelo
wrengr 2016/11/22 18:33:40 Acknowledged.
class Result(object):
"""Represents findit culprit result."""
@@ -25,7 +34,6 @@ class Result(object):
# TODO(wrengr): (a) make these two fields private/readonly
# TODO(wrengr): (b) zip them together.
- # TODO(http://crbug.com/661822): change stack_info pair to a namedtuple.
self.file_to_stack_infos = {}
self.file_to_analysis_info = {}
@@ -83,8 +91,8 @@ class MatchResult(Result):
Args:
file_path (str): File path of the crashed file.
- stack_infos (list): List of (frame, stack_priority), represents frames of
- this file and the callstack priorities of those frames.
+ stack_infos (list of StackInfo): List of the frames of this file
+ together with their callstack priorities.
blame (Blame): Blame oject of this file.
"""
self.file_to_stack_infos[file_path] = stack_infos

Powered by Google App Engine
This is Rietveld 408576698