Tsukihjy/testcase / testcase-data /Ours /update_fixed_right_code_v23.py
Tsukihjy's picture
download
raw
1.03 kB
import json
## 移除非AC的正解代码
upudate_file = "/home/luoxianzhen/yang/eval/ALLmode_results/tcb-Sample_Right_code-rank5-all.json"
correct_code_result = json.load(open(upudate_file, "r", encoding="utf-8"))
tcb_bench = json.load(open("/home/luoxianzhen/yang/data/Ours/TestcaseBench-v28.json", "r", encoding="utf-8"))
print(len(tcb_bench))
update_count = 0
for item in tcb_bench:
tcb_id = item['tcb_id']
# print(tcb_id)
code_status = correct_code_result[tcb_id]['codes']
for c_code in code_status:
remove_list = []
if c_code['status'] != ['AC']:
print(f"del {tcb_id} - {c_code['code_id']}")
remove_list.append(c_code['code_id'])
remove_list.sort(reverse=True)
# 删除对应索引的元素
for i in remove_list:
del item['solutions'][i]
print(f"删除了 {update_count} 个样本")
json.dump(tcb_bench, open(f"/home/luoxianzhen/yang/data/Ours/TestcaseBench-v29.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False)

Xet Storage Details

Size:
1.03 kB
·
Xet hash:
253da65687cf3c95256443ecb3624a8536478fdcb1cc0e5e6a5e35f8d1b95166

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