Skip to content

Commit 7ed57c2

Browse files
committed
Add a IssueModel class to be extended by models that operate on GitHub issues
Part of #259
1 parent a3b62fd commit 7ed57c2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bugbug/model.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from sklearn.model_selection import cross_validate, train_test_split
2424
from tabulate import tabulate
2525

26-
from bugbug import bugzilla, db, repository
26+
from bugbug import bugzilla, db, github, repository
2727
from bugbug.nlp import SpacyVectorizer
2828
from bugbug.utils import split_tuple_generator, to_array
2929

@@ -757,3 +757,17 @@ def items_gen(self, classes):
757757

758758
for (bug_id1, bug_id2), label in classes.items():
759759
yield (bugs[bug_id1], bugs[bug_id2]), label
760+
761+
762+
class IssueModel(Model):
763+
def __init__(self, lemmatization=False):
764+
Model.__init__(self, lemmatization)
765+
self.training_dbs = [github.GITHUB_ISSUES_DB]
766+
767+
def items_gen(self, classes):
768+
for issue in github.get_issues():
769+
issue_number = issue["number"]
770+
if issue_number not in classes:
771+
continue
772+
773+
yield issue, classes[issue_number]

0 commit comments

Comments
 (0)