Datasets:

Languages:
code
Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
debugging
License:
albertvillanova HF staff commited on
Commit
9a4575a
1 Parent(s): 9c500d9

Delete loading script

Browse files
Files changed (1) hide show
  1. code_x_glue_cc_code_refinement.py +0 -93
code_x_glue_cc_code_refinement.py DELETED
@@ -1,93 +0,0 @@
1
- from typing import List
2
-
3
- import datasets
4
-
5
- from .common import TrainValidTestChild
6
- from .generated_definitions import DEFINITIONS
7
-
8
-
9
- _DESCRIPTION = """We use the dataset released by this paper(https://arxiv.org/pdf/1812.08693.pdf). The source side is a Java function with bugs and the target side is the refined one. All the function and variable names are normalized. Their dataset contains two subsets ( i.e.small and medium) based on the function length."""
10
- _CITATION = """@article{10.1145/3340544,
11
- author = {Tufano, Michele and Watson, Cody and Bavota, Gabriele and Penta, Massimiliano Di and White, Martin and Poshyvanyk, Denys},
12
- title = {An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation},
13
- year = {2019},
14
- issue_date = {October 2019},
15
- publisher = {Association for Computing Machinery},
16
- address = {New York, NY, USA},
17
- volume = {28},
18
- number = {4},
19
- issn = {1049-331X},
20
- url = {https://doi-org.proxy.wm.edu/10.1145/3340544},
21
- doi = {10.1145/3340544},
22
- abstract = {Millions of open source projects with numerous bug fixes are available in code repositories. This proliferation of software development histories can be leveraged to learn how to fix common programming bugs. To explore such a potential, we perform an empirical study to assess the feasibility of using Neural Machine Translation techniques for learning bug-fixing patches for real defects. First, we mine millions of bug-fixes from the change histories of projects hosted on GitHub in order to extract meaningful examples of such bug-fixes. Next, we abstract the buggy and corresponding fixed code, and use them to train an Encoder-Decoder model able to translate buggy code into its fixed version. In our empirical investigation, we found that such a model is able to fix thousands of unique buggy methods in the wild. Overall, this model is capable of predicting fixed patches generated by developers in 9--50% of the cases, depending on the number of candidate patches we allow it to generate. Also, the model is able to emulate a variety of different Abstract Syntax Tree operations and generate candidate patches in a split second.},
23
- journal = {ACM Trans. Softw. Eng. Methodol.},
24
- month = sep,
25
- articleno = {19},
26
- numpages = {29},
27
- keywords = {bug-fixes, Neural machine translation}
28
- }"""
29
-
30
-
31
- class CodeXGlueCcCodeRefinementImpl(TrainValidTestChild):
32
- _DESCRIPTION = _DESCRIPTION
33
- _CITATION = _CITATION
34
-
35
- _FEATURES = {
36
- "id": datasets.Value("int32"), # Index of the sample
37
- "buggy": datasets.Value("string"), # The buggy version of the code
38
- "fixed": datasets.Value("string"), # The correct version of the code
39
- }
40
-
41
- _SUPERVISED_KEYS = ["fixed"]
42
-
43
- def generate_urls(self, split_name):
44
- size = self.info["parameters"]["size"]
45
- for key in "buggy", "fixed":
46
- yield key, f"{size}/{split_name}.buggy-fixed.{key}"
47
-
48
- def _generate_examples(self, split_name, file_paths):
49
- """This function returns the examples in the raw (text) form."""
50
- # Open each file (one for java, and one for c#)
51
- files = {k: open(file_paths[k], encoding="utf-8") for k in file_paths}
52
-
53
- id_ = 0
54
- while True:
55
- # Read a single line from each file
56
- entries = {k: files[k].readline() for k in file_paths}
57
-
58
- empty = self.check_empty(entries)
59
- if empty:
60
- # We are done: end of files
61
- return
62
-
63
- entries["id"] = id_
64
- yield id_, entries
65
- id_ += 1
66
-
67
-
68
- CLASS_MAPPING = {
69
- "CodeXGlueCcCodeRefinement": CodeXGlueCcCodeRefinementImpl,
70
- }
71
-
72
-
73
- class CodeXGlueCcCodeRefinement(datasets.GeneratorBasedBuilder):
74
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
75
- BUILDER_CONFIGS = [
76
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
77
- ]
78
-
79
- def _info(self):
80
- name = self.config.name
81
- info = DEFINITIONS[name]
82
- if info["class_name"] in CLASS_MAPPING:
83
- self.child = CLASS_MAPPING[info["class_name"]](info)
84
- else:
85
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
86
- ret = self.child._info()
87
- return ret
88
-
89
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
90
- return self.child._split_generators(dl_manager=dl_manager)
91
-
92
- def _generate_examples(self, split_name, file_paths):
93
- return self.child._generate_examples(split_name, file_paths)