chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:24:13 +08:00
commit 1037506f2e
6050 changed files with 1731598 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import sys
import json
import os
import argparse
sys.set_int_max_str_digits(0)
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from data.apps import APPsWithFunctionName
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--output_file", type=str)
args = parser.parse_args()
# reader = APPsWithFunctionName(split="test", use_starter_code=True)
reader = APPsWithFunctionName(split="train", train_sub_split="train", use_starter_code=True)
data = reader("codeparrot/apps")
# prompt_template = "{question}\n\nPlease write a program to solve the above problem under the given time constraints and memory limits."
prompt_template = "{question}\n\nPlease write a Python program to solve the above problem under the given time constraints and memory limits."
inputs = []
for item in data:
prompt = prompt_template.format(question=item["question"])
item["prompt"] = prompt
inputs.append(item)
with open(args.output_file, "w", encoding="utf-8") as f:
for item in inputs:
f.write(json.dumps(item, ensure_ascii=False) + "\n")
print(len(inputs))
if __name__ == "__main__":
main()