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

Side by Side Diff: appengine/findit/crash/loglinear/changelist_features/min_distance.py

Issue 2663063007: [Predator] Switch from anonymous dict to CrashData. (Closed)
Patch Set: Rebase and fix delta test. Created 3 years, 10 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 import logging 5 import logging
6 import math 6 import math
7 7
8 from crash.loglinear.changelist_classifier import StackInfo 8 from crash.loglinear.changelist_classifier import StackInfo
9 from crash.loglinear.feature import ChangedFile 9 from crash.loglinear.feature import ChangedFile
10 from crash.loglinear.feature import Feature 10 from crash.loglinear.feature import Feature
11 from crash.loglinear.feature import FeatureValue 11 from crash.loglinear.feature import FeatureValue
12 from crash.loglinear.feature import LogLinearlyScaled 12 from crash.loglinear.feature import LogLinearlyScaled
13 from libs.gitiles.diff import ChangeType 13 from libs.gitiles.diff import ChangeType
14 import libs.math.logarithms as lmath 14 import libs.math.logarithms as lmath
15 15
16 16
17
18 class ModifiedFrameInfo(object): 17 class ModifiedFrameInfo(object):
19 """Represents the closest frame to a changelog which modified it. 18 """Represents the closest frame to a changelog which modified it.
20 19
21 The "closest" means that the distance between crashed lines in the frame and 20 The "closest" means that the distance between crashed lines in the frame and
22 touched lines in a changelog is minimum. 21 touched lines in a changelog is minimum.
23 22
24 Properties: 23 Properties:
25 distance (int or float('inf')): The distance between crashed lines and 24 distance (int or float('inf')): The distance between crashed lines and
26 touched lines, if a changelog doesn't show in blame of the crashed file of 25 touched lines, if a changelog doesn't show in blame of the crashed file of
27 the crashed version (either it didn't touch the crashed file or it got 26 the crashed version (either it didn't touch the crashed file or it got
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 261
263 if not frame_index_to_changed_files: # pragma: no cover 262 if not frame_index_to_changed_files: # pragma: no cover
264 logging.warning('Found no changed files for suspect: %s', str(suspect)) 263 logging.warning('Found no changed files for suspect: %s', str(suspect))
265 return [] 264 return []
266 265
267 # Sort changed file by frame index. 266 # Sort changed file by frame index.
268 _, changed_files = zip(*sorted(frame_index_to_changed_files.iteritems(), 267 _, changed_files = zip(*sorted(frame_index_to_changed_files.iteritems(),
269 key=lambda x: x[0])) 268 key=lambda x: x[0]))
270 269
271 return list(changed_files) 270 return list(changed_files)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698