Skip to content

Commit

Permalink
Merge branch 'change_classifier_interface' into 'develop'
Browse files Browse the repository at this point in the history
Add repo as an argument of predict(), mainly for bitbcnn classifier

See merge request persper/code-analytics!112
  • Loading branch information
kagami-l committed Jun 7, 2019
2 parents 3412514 + 2da61cd commit 08f8c10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion persper/analytics/analyzer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async def _analyzeCommit(self, commit: Union[Commit, str], parentCommit: Union[C

# commit classification
if self._commit_classifier and commit.hexsha not in self._clf_results:
prob = self._commit_classifier.predict(commit, diff_index)
prob = self._commit_classifier.predict(commit, diff_index, self._repo)
self._clf_results[commit.hexsha] = prob

# t2: update_graph + git diff traversing time
Expand Down
5 changes: 3 additions & 2 deletions persper/analytics/commit_classifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from git import Commit, DiffIndex
from git import Commit, DiffIndex, Repo


class CommitClassifier(ABC):
Expand All @@ -8,13 +8,14 @@ class CommitClassifier(ABC):
"""

@abstractmethod
def predict(self, commit: Commit, diff_index: DiffIndex):
def predict(self, commit: Commit, diff_index: DiffIndex, repo: Repo):
"""
Args:
commit: A gitpython's Commit object.
diff_index: A gitpython's DiffIndex object.
It is a list of Diff object, each containing the
diff information between a pair of old/new source files.
repo: A gitpython's Repo object.
Returns:
Expand Down

0 comments on commit 08f8c10

Please sign in to comment.