system HF staff commited on
Commit
7969364
1 Parent(s): 8740f45

Update files from the datasets library (from 1.16.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.16.0

Files changed (2) hide show
  1. README.md +2 -1
  2. great_code.py +25 -27
README.md CHANGED
@@ -18,9 +18,10 @@ task_categories:
18
  task_ids:
19
  - table-to-text
20
  paperswithcode_id: null
 
21
  ---
22
 
23
- # Dataset Card Creation Guide
24
 
25
  ## Table of Contents
26
  - [Dataset Description](#dataset-description)
 
18
  task_ids:
19
  - table-to-text
20
  paperswithcode_id: null
21
+ pretty_name: GREAT
22
  ---
23
 
24
+ # Dataset Card for GREAT
25
 
26
  ## Table of Contents
27
  - [Dataset Description](#dataset-description)
great_code.py CHANGED
@@ -133,30 +133,28 @@ class GreatCode(datasets.GeneratorBasedBuilder):
133
  def _generate_examples(self, datapath, datatype):
134
  for file_idx, dp in enumerate(datapath):
135
  with open(dp, "r", encoding="utf-8") as json_file:
136
- json_list = list(json_file)
137
-
138
- for example_counter, json_str in enumerate(json_list):
139
- result = json.loads(json_str)
140
- response = {
141
- "id": example_counter,
142
- "source_tokens": result["source_tokens"],
143
- "has_bug": result["has_bug"],
144
- "error_location": result["error_location"],
145
- "repair_candidates": [str(x) for x in result["repair_candidates"]],
146
- "bug_kind": result["bug_kind"],
147
- "bug_kind_name": result["bug_kind_name"],
148
- "repair_targets": result["repair_targets"],
149
- "edges": [
150
- [
151
- {
152
- "before_index": result["edges"][x][0],
153
- "after_index": result["edges"][x][1],
154
- "edge_type": result["edges"][x][2],
155
- "edge_type_name": result["edges"][x][3],
156
- }
157
- ]
158
- for x in range(len(result["edges"]))
159
- ],
160
- "provenances": result["provenances"],
161
- }
162
- yield f"{file_idx}_{example_counter}", response
 
133
  def _generate_examples(self, datapath, datatype):
134
  for file_idx, dp in enumerate(datapath):
135
  with open(dp, "r", encoding="utf-8") as json_file:
136
+ for example_counter, json_str in enumerate(json_file):
137
+ result = json.loads(json_str)
138
+ response = {
139
+ "id": example_counter,
140
+ "source_tokens": result["source_tokens"],
141
+ "has_bug": result["has_bug"],
142
+ "error_location": result["error_location"],
143
+ "repair_candidates": [str(x) for x in result["repair_candidates"]],
144
+ "bug_kind": result["bug_kind"],
145
+ "bug_kind_name": result["bug_kind_name"],
146
+ "repair_targets": result["repair_targets"],
147
+ "edges": [
148
+ [
149
+ {
150
+ "before_index": result["edges"][x][0],
151
+ "after_index": result["edges"][x][1],
152
+ "edge_type": result["edges"][x][2],
153
+ "edge_type_name": result["edges"][x][3],
154
+ }
155
+ ]
156
+ for x in range(len(result["edges"]))
157
+ ],
158
+ "provenances": result["provenances"],
159
+ }
160
+ yield f"{file_idx}_{example_counter}", response