Add function to get labels for tracked/non-tracked bugs

Former-commit-id: 4c2747b56c
This commit is contained in:
Marco Castelluccio 2018-11-16 17:58:54 +01:00
Родитель 9d451b4502
Коммит e25e83ec13
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -8,6 +8,26 @@ import csv
import bugzilla
def get_tracking_labels():
classes = {}
for bug_data in bugzilla.get_bugs():
bug_id = int(bug_data['id'])
for entry in bug_data['history']:
for change in entry['changes']:
if change['field_name'].startswith('cf_tracking_firefox'):
if change['added'] in ['blocking', '+']:
classes[bug_id] = True
elif change['added'] == '-':
classes[bug_id] = False
if bug_id not in classes:
classes[bug_id] = False
return classes
def get_labels(augmentation=False):
with open('classes.csv', 'r') as f:
classes = dict([row for row in csv.reader(f)][1:])