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

Unified Diff: appengine/findit/crash/loglinear/changelist_classifier.py

Issue 2605943002: Removing the mutation in the factories for getting dep repositories (Closed)
Patch Set: Created 4 years 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/loglinear/changelist_classifier.py
diff --git a/appengine/findit/crash/loglinear/changelist_classifier.py b/appengine/findit/crash/loglinear/changelist_classifier.py
index 740f199ef116f801b854733d4563702aad2e1cb6..f25430adb419f556fe9994aa53b352e9a5f84df1 100644
--- a/appengine/findit/crash/loglinear/changelist_classifier.py
+++ b/appengine/findit/crash/loglinear/changelist_classifier.py
@@ -18,10 +18,8 @@ from crash.stacktrace import Stacktrace
class LogLinearChangelistClassifier(object):
"""A ``LogLinearModel``-based implementation of CL classification."""
- def __init__(self, repository, get_repository, weights, top_n_frames=7,
- top_n_suspects=3):
+ def __init__(self, get_repository, weights, top_n_frames=7, top_n_suspects=3):
"""Args:
- repository (Repository): the Git repository for getting CLs to classify.
get_repository (callable): a function from DEP urls to ``Repository``
objects, so we can get changelogs and blame for each dep. Notably,
to keep the code here generic, we make no assumptions about
@@ -36,8 +34,7 @@ class LogLinearChangelistClassifier(object):
top_n_frames (int): how many frames of each callstack to look at.
top_n_suspects (int): maximum number of suspects to return.
"""
- self._repository = repository
- self._dependency_fetcher = ChromeDependencyFetcher(self._repository)
+ self._dependency_fetcher = ChromeDependencyFetcher(get_repository)
self._get_repository = get_repository
self._top_n_frames = top_n_frames
self._top_n_suspects = top_n_suspects
@@ -133,7 +130,7 @@ class LogLinearChangelistClassifier(object):
dep_to_file_to_changelogs, ignore_cls = (
changelist_classifier.GetChangeLogsForFilesGroupedByDeps(
- regression_deps_rolls, stack_deps, self._repository))
+ regression_deps_rolls, stack_deps, self._get_repository))
dep_to_file_to_stack_infos = (
changelist_classifier.GetStackInfosForFilesGroupedByDeps(
report.stacktrace, stack_deps))

Powered by Google App Engine
This is Rietveld 408576698