Chromium Code Reviews| Index: appengine/findit/crash/stacktrace.py |
| diff --git a/appengine/findit/crash/stacktrace.py b/appengine/findit/crash/stacktrace.py |
| index 0a70b9a908afa232563cdf80b95e85f42613b156..45dcc4241e69dc8aa9981d4fc3d7fa4fb9a39fac 100644 |
| --- a/appengine/findit/crash/stacktrace.py |
| +++ b/appengine/findit/crash/stacktrace.py |
| @@ -2,6 +2,7 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +from collections import namedtuple |
| import logging |
| import re |
| @@ -22,7 +23,9 @@ CALLSTACK_FORMAT_TO_PATTERN = { |
| FRAME_INDEX_PATTERN = re.compile(r'\s*#(\d+)\s.*') |
| -class StackFrame(object): |
| +class StackFrame(namedtuple('StackFrame', |
| + ['index', 'dep_path', 'function', 'file_path', 'raw_file_path', |
| + 'crashed_line_numbers', 'repo_url'])): |
| """Represents a frame in a stacktrace. |
| Attributes: |
| @@ -39,16 +42,13 @@ class StackFrame(object): |
| crashed_line_numbers (list): Line numbers of the file that caused the crash. |
| repo_url (str): Repo url of this frame. |
| """ |
| - def __init__(self, index, dep_path, function, |
| - file_path, raw_file_path, crashed_line_numbers, |
| - repo_url=None): |
| - self.index = index |
| - self.dep_path = dep_path |
| - self.function = function |
| - self.file_path = file_path |
| - self.raw_file_path = raw_file_path |
| - self.crashed_line_numbers = crashed_line_numbers |
| - self.repo_url = repo_url |
| + __slots__ = () |
| + |
| + def __new__(cls, index, dep_path, function, file_path, raw_file_path, |
| + crashed_line_numbers, repo_url=None): |
|
Sharu Jiang
2016/11/21 23:31:57
the repo_url can be changed to required argument.
wrengr
2016/11/22 18:33:40
That'll be a pretty invasive change, since it'll a
|
| + return super(cls, StackFrame).__new__(cls, |
| + index, dep_path, function, file_path, raw_file_path, |
| + crashed_line_numbers, repo_url) |
| def ToString(self): |
| frame_str = '#%d in %s @ %s' % (self.index, self.function, self.file_path) |