S-Dreamer commited on
Commit
6e27ba3
·
verified ·
1 Parent(s): 31a4405

Create codegauntlt.py

Browse files
Files changed (1) hide show
  1. codegauntlt.py +69 -0
codegauntlt.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # coding=utf-8
3
+ # CodeGauntlt dataset loading script for Hugging Face Datasets
4
+ # path: codegauntlt.py
5
+
6
+ import json
7
+ import datasets
8
+
9
+ _DESCRIPTION = """\
10
+ CodeGauntlt is a multi-source dataset designed for evaluating and enhancing the robustness of AI code repair and generation agents. It introduces adversarially-constructed, obfuscated, or deceptive bugs across several programming languages, based on real-world and synthetic sources.
11
+ """
12
+
13
+ _HOMEPAGE = "https://huggingface.co/datasets/HackerHardware/CodeGauntlt"
14
+
15
+ _CITATION = """\
16
+ @misc{codegauntlt2025,
17
+ title={CodeGauntlt: A Dataset for Adversarial Evaluation of Code Repair Models},
18
+ author={Esteban and Collaborators},
19
+ year={2025},
20
+ howpublished={\\url{https://huggingface.co/datasets/HackerHardware/CodeGauntlt}},
21
+ }
22
+ """
23
+
24
+ class CodeGauntlt(datasets.GeneratorBasedBuilder):
25
+ VERSION = datasets.Version("1.0.0")
26
+
27
+ def _info(self):
28
+ features = datasets.Features(
29
+ {
30
+ "id": datasets.Value("string"),
31
+ "source": datasets.Value("string"),
32
+ "description": datasets.Value("string"),
33
+ "code_buggy": datasets.Value("string"),
34
+ "code_fixed": datasets.Value("string"),
35
+ "bug_type": datasets.Value("string"),
36
+ "tags": datasets.Value("string"),
37
+ "metadata": datasets.Value("string")
38
+ }
39
+ )
40
+ return datasets.DatasetInfo(
41
+ description=_DESCRIPTION,
42
+ features=features,
43
+ homepage=_HOMEPAGE,
44
+ citation=_CITATION,
45
+ license="apache-2.0"
46
+ )
47
+
48
+ def _split_generators(self, dl_manager):
49
+ data_dir = dl_manager.download_and_extract("./data")
50
+ return [
51
+ datasets.SplitGenerator(
52
+ name=datasets.Split.TRAIN,
53
+ gen_kwargs={"filepath": f"{data_dir}/train.jsonl"}
54
+ ),
55
+ datasets.SplitGenerator(
56
+ name=datasets.Split.VALIDATION,
57
+ gen_kwargs={"filepath": f"{data_dir}/validation.jsonl"}
58
+ ),
59
+ datasets.SplitGenerator(
60
+ name=datasets.Split.TEST,
61
+ gen_kwargs={"filepath": f"{data_dir}/test.jsonl"}
62
+ ),
63
+ ]
64
+
65
+ def _generate_examples(self, filepath):
66
+ with open(filepath, encoding="utf-8") as f:
67
+ for i, line in enumerate(f):
68
+ record = json.loads(line)
69
+ yield i, record