Esempio n. 1
0
def get_ranker_results_with_objs(project_name, version, ranker_obj, filter_obj,
                                 provider):
    spectra_file = spectra_maker.get_spectra_file(project_name, version)
    run_to_result = run_result.load(spectra_file)

    buggy_lines = projects.get_known_buggy_lines(project_name,
                                                 version)
    if buggy_lines is None:
        print("Buggy lines aren't known for version {0}".format(version))
        return None



    failing_to_rankres = {}
    for failing_test_num, run_res in provider.get_run_results(run_to_result):
        failing_to_rankres[failing_test_num] = compute_results(run_res,
                                                               ranker_obj,
                                                               filter_obj,
                                                               buggy_lines)

    ret = {}
    for failing,rank_res in failing_to_rankres.items():
        key = "{0}-{1}-{2}".format(project_name, version, failing)
        ret[key] = rank_res
    return ret
def compute_features(project_name):
    if not os.path.exists(FEATURE_DIR):
        os.mkdir(FEATURE_DIR)

    for version in projects.get_version_names(project_name):
        fname = get_feature_file(project_name, version)
        if os.path.exists(fname):
            print("V {0} Already exists, skipping".format(version))
            continue

        print("Computing version {0}".format(version))
        spectra_file = spectra_maker.get_spectra_file(project_name, version)
        make_feature_file(spectra_file, fname)