download
raw
1.42 kB
import json
import sys
sys.path.append("/home/luoxianzhen/yang/methods/utils")
from dataset_all import get_datasets_by_name
import os
def get_testcases(testcase_path):
data = []
if not os.path.exists(testcase_path):
return {}
with open(testcase_path, 'r', encoding='utf-8') as f:
for line in f:
if line.strip():
data.append(json.loads(line))
return data[0]
tcb_datasets = get_datasets_by_name("ours")
tcb_datasets_dict = {}
for item in tcb_datasets:
tcb_datasets_dict[item['tcb_id']] = item
test_path = "/home/i-luoxianzhen/data/TestCase-Gen/save_tests_scaling/ht/tests-{}.jsonl"
name = "ht"
test_result_all_file = "/home/luoxianzhen/yang/eval/ALLmode_results/tcb-Sample_Wrong_code-rank5-all.json"
wrong_code_total = 0
test_result_all = json.load(open(test_result_all_file, "r"))
ce_list = []
for k, item in test_result_all.items():
for wrong in item['codes']:
if wrong['status'] == ["EXE"] or wrong['status'] == ["CE"]:
wrong['tcb_id'] = k
# if k not in tcb_datasets_dict.keys():
# continue
wrong["query"] = tcb_datasets_dict[k]['query']
wrong['sample'] = tcb_datasets_dict[k]['sample']
ce_list.append(wrong)
json.dump(ce_list, open(f"/home/luoxianzhen/yang/eval/To-fix-wrong-code-v26-EXE.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False)

Xet Storage Details

Size:
1.42 kB
·
Xet hash:
4c7df33020f1d7e0b84c96ca215ff7c32b81b05ea69e4b5896360fe017a69077

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.