Make download_bugs_between return downloaded bugs

This commit is contained in:
Marco Castelluccio 2019-02-28 20:18:01 +01:00
Родитель f3a49fcd7a
Коммит 19abd72091
2 изменённых файлов: 6 добавлений и 9 удалений

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

@ -131,7 +131,7 @@ def download_bugs_between(date_from, date_to, security=False):
old_bug_ids = set(bug['id'] for bug in get_bugs())
all_ids = []
all_bugs = []
with tqdm(total=count) as progress_bar:
for offset in range(0, count, Bugzilla.BUGZILLA_CHUNK_SIZE):
@ -141,11 +141,11 @@ def download_bugs_between(date_from, date_to, security=False):
progress_bar.update(Bugzilla.BUGZILLA_CHUNK_SIZE)
all_ids += [bug for bug in new_bugs.values()]
all_bugs += [bug for bug in new_bugs.values()]
db.append(BUGS_DB, (bug for bug_id, bug in new_bugs.items() if bug_id not in old_bug_ids))
return all_ids
return all_bugs
def download_bugs(bug_ids, products=None, security=False):

9
run.py
Просмотреть файл

@ -92,18 +92,15 @@ if __name__ == '__main__':
if args.generate_sheet:
today = datetime.utcnow()
a_week_ago = today - timedelta(7)
bug_ids = bugzilla.download_bugs_between(a_week_ago, today)
bugs = bugzilla.download_bugs_between(a_week_ago, today)
print(f'Classifying {len(bug_ids)} bugs...')
print(f'Classifying {len(bugs)} bugs...')
rows = [
['Bug', f'{args.goal}(model)', args.goal, 'Title']
]
for bug in bugzilla.get_bugs():
if bug['id'] not in bug_ids:
continue
for bug in bugs:
p = model.classify(bug, probabilities=True)
rows.append([f'https://bugzilla.mozilla.org/show_bug.cgi?id={bug["id"]}', 'y' if p[0][1] >= 0.7 else 'n', '', bug['summary']])