コード例 #1
0
def tabulate_pass_rates(versions, qualapps, year):
    ''' Table: rows are apps, columns are versions, cell is pass rate.
        Year is given, so the pass rates shown are for just one year.
    '''
    year_root = corpus_for_year(year)
    year_apps = [app for app in get_dirnames(year_root) if app in qualapps]
    percs = test_or_read(versions, year, year_apps, year_root)
    print_latex_table(prettify(versions), year_apps, year_root, percs)
コード例 #2
0
def test_all_years(versions, qualapps, year_list):
    ''' For all the given years, get the lowest version with enough passes.
        For each year return a list of (app, oldest-version) pairs.
    '''
    oldest = {}  # Maps year to list of (app, oldest-version) pairs
    for year in year_list:
        oldest[year] = []
        year_root = corpus_for_year(year)
        year_apps = [app for app in get_dirnames(year_root) if app in qualapps]
        percs = test_or_read(versions, year, year_apps, year_root)
        for i, app in enumerate(year_apps):
            best_ver = find_oldest_ver(versions, percs[i])
            if best_ver:
                oldest[year].append((app, best_ver))
    return oldest
コード例 #3
0
def get_pyvers_appnames(given_args, test_dir=qualitas.get_root_dir()):
    ''' Use the (command-line) args to specify front-end(s) or app(s) '''
    full_suite = qualitas.get_dirnames(test_dir)
    qualapps = []
    versions = []
    for arg in given_args:
        if arg in SERIES2 + SERIES3:
            versions.append(arg)
        elif arg in full_suite:
            qualapps.append(arg)
        else:
            safe_print('Unkown argument: "%s"' % arg, sys.stderr)
            sys.exit(1)
    if versions == []:  # None specified, so use "all" the Python front-ends
        versions = FOR_ESEM
    if qualapps == []:  # None specified, so test "all" the applications
        qualapps = full_suite
    return (versions, qualapps)
コード例 #4
0
def plot_pass_rates(versions, qualapps, year, save_as=None):
    ''' Graph of pass rates; x-axis is version, y-axis is % rate.
        Each line on graph represents a single app.
    '''
    # First, get the data:
    year_root = corpus_for_year(year)
    year_apps = [app for app in get_dirnames(year_root) if app in qualapps]
    percs = test_or_read(versions, year, year_apps, year_root)
    # Now plot:
    fig, ax = plt.subplots(figsize=(9, 7))
    ver_xlocs = np.arange(len(versions))
    for appdata in percs:
        ax.plot(ver_xlocs, appdata)
    plt.xlabel('Python Versions')
    plt.xticks(ver_xlocs, prettify(versions))
    plt.ylabel('Percentage of files passing')
    plt.yticks(np.arange(0, 105, 5))
    ax.yaxis.grid(True, linestyle='--', which='major', color='grey', alpha=.25)
    plt.savefig(save_as, bbox_inches='tight') if save_as else plt.show()
コード例 #5
0
    print('\\begin{tabular}{l*{%d}{c}r}' % len(pyvers))
    titles = ['Application'] + pyvers + ['Total']
    print(latex_table_row(titles, 'bf', True))
    for qapp in qualapps:
        counts, row_tot = categorise(pyvers, qapp)
        if num_and_perc:  #Print number, shade by percentage
            this_row = [
                '\\shadeper{%d}{%d}' % (d, perc(d, row_tot)) for d in counts
            ]
        else:  # Just print the percentage
            this_row = ['%d' % perc(d, row_tot) for d in counts]
        this_row = [qapp] + this_row + [row_tot]
        print(latex_table_row(this_row))
    print('\\hline')
    print('\\end{tabular}')


if __name__ == '__main__':
    full_suite = qualitas.get_dirnames()
    qualapps = []
    for arg in sys.argv[1:]:
        if arg in full_suite:
            qualapps.append(arg)
        else:
            safe_print('Unkown argument: "%s"' % arg, sys.stderr)
            sys.exit(1)
    if qualapps == []:  # None specified, so test *all* the applications
        qualapps = full_suite
    pyvers = python_versions.get_releases('3')
    print_date_counts(pyvers, qualapps, False, categorise_commits)
コード例 #6
0
    plt.xticks(yr_xlocs, [y for y, _ in year_counts])  # years on x axis
    plt.ylabel('No. of applications passing')
    plt.yticks(np.arange(0, 51, 5))  # no. of apps on y axis
    ax1.yaxis.grid(True,
                   linestyle='--',
                   which='major',
                   color='grey',
                   alpha=.25)
    plt.legend([b[0] for b in bars], prettify(versions), loc=2)
    plt.savefig(save_as, bbox_inches='tight') if save_as else plt.show()


# Probably want to do one or the other of these:
_versions_for = {
    2: ['2.0', '2.2', '2.4', '2.5', '2.6', '2.7'],
    3: ['3.0', '3.1', '3.3.0', '3.5.0', '3.6.0'],
}

_SERIES = 3  ### EDIT ME TO SUIT

if __name__ == '__main__':
    qualapps = get_dirnames()  # All applications
    versions = _versions_for[_SERIES]
    oldest = test_all_years(versions, qualapps, _YEAR_LIST)
    year_counts = sum_year_counts(versions, oldest)
    show_year_counts(versions, year_counts)
    tabulate_by_app(qualapps, oldest)
    plot_bar_chart(versions, year_counts, _BARCHART_PDF.format(_SERIES))
    #plot_pass_rates(versions, qualapps, '2016',
    #                'versions-2016-s{}.pdf'.format(series))