| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import logging |
| 6 from collections import namedtuple |
| 7 |
| 8 from crash.stacktrace import Stacktrace |
| 9 |
| 10 class CrashReport(namedtuple('CrashReport', |
| 11 ['crashed_version', 'signature', 'platform', 'stacktrace', |
| 12 'regression_range'])): |
| 13 """A reported crash we want to analyze. |
| 14 |
| 15 This class comprises the inputs to the Azalea library; as distinguished |
| 16 from the Culprit class, which comprises the outputs/results of Azalea's |
| 17 analyses. N.B., the appengine clients conflate input and output into |
| 18 a single CrashAnalysis(ndb.Model) class, but that's up to them; in |
| 19 the library we keep inputs and outputs entirely distinct. |
| 20 |
| 21 Args: |
| 22 crashed_version (str): The version of Chrome in which the crash occurred. |
| 23 signature (str): The signature of the crash on the Chrome crash server. |
| 24 platform (str): The platform name; e.g., 'win', 'mac', 'linux', 'android', |
| 25 'ios', etc. |
| 26 stacktrace (Stacktrace): The stacktrace of the crash. N.B., this is |
| 27 an object generated by parsing the string containing the stack trace; |
| 28 we do not store the string itself. |
| 29 regression_range : a pair of the last-good and first-bad |
| 30 versions. N.B., because this is an input, it is up to clients |
| 31 to call DetectRegressionRange (or whatever else) in order to |
| 32 provide this information. |
| 33 """ |
| 34 __slots__ = () |
| 35 |
| 36 def __new__(cls, crashed_version, signature, platform, stacktrace, |
| 37 regression_range): |
| 38 # TODO: should raise a TypeError rather than an AssertionError |
| 39 assert isinstance(stacktrace, Stacktrace), ( |
| 40 'In the fourth argument to CrashReport constructor, ' |
| 41 'expected Stacktrace object, but got %s object instead.' |
| 42 % stacktrace.__class__.__name__) |
| 43 |
| 44 return super(cls, CrashReport).__new__(cls, |
| 45 crashed_version, signature, platform, stacktrace, regression_range) |
| OLD | NEW |