def issues_popcon_annotate(issues_list): # outputs [(package, popcon, is_popular)] where is_popular True if it's # in the upper 1/4 of issues_list, i.e. a relative measure try: n = len(issues_list) popcon_dict = dict((p, 0) for p in issues_list) popcon_dict.update(popcon.source_package(*issues_list)) issues = sorted(popcon_dict.items(), key=lambda p: p[0]) issues_by_popcon = sorted(issues, key=lambda p: p[1], reverse=True) issues_with_popcon = [(p[0], p[1], i<n/4) for i, p in enumerate(issues_by_popcon)] return sorted(issues_with_popcon, key=lambda p: p[0]) except UnicodeDecodeError: return issues_list
write_html_page(title=title, body=html, destfile=destfile, left_nav_html=left_nav_html) log.info('Issues index now available at ' + desturl) if __name__ == '__main__': issues_count = {} bugs = Bugs().bugs notes = load_notes() issues = load_issues() iterate_over_notes(notes) iterate_over_issues(issues) try: index_issues(issues, OrderedDict([ ("Sum of packages' popcon scores", lambda l: sum(popcon.source_package(*l).values())), ("Sum of square-roots of packages' popcon scores", lambda l: int(sum(map(sqrt, popcon.source_package(*l).values())))), ("Number of packages", len), ])) except UnicodeDecodeError: pass purge_old_notes(notes) purge_old_issues(issues) gen_packages_html([Package(x) for x in notes]) for suite in SUITES: for arch in ARCHS: build_page('notes', suite, arch) build_page('no_notes', suite, arch) build_page('FTBFS', suite, arch)
def test_source_package(caplog): popcon.source_package('reportbug') assert 'deprecated' in caplog.text
def test_source_package(): popcon.source_package('reportbug')
def test_source_packages(): res = popcon.source_package(['reportbug', 'python-debianbts']) assert len(res) == 2