Datasets:
Commit
·
3618cd0
1
Parent(s):
ae6d579
Update bc-transcoder.py
Browse files- bc-transcoder.py +20 -7
bc-transcoder.py
CHANGED
|
@@ -48,6 +48,13 @@ _VERSION = "1.0.0"
|
|
| 48 |
|
| 49 |
_KEYS_REMOVE = {"text", "signature_with_docstring"}
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
class BCTranscoder(datasets.GeneratorBasedBuilder):
|
| 53 |
"""BC-Transcoder"""
|
|
@@ -77,13 +84,13 @@ class BCTranscoder(datasets.GeneratorBasedBuilder):
|
|
| 77 |
"language": datasets.Value("string"),
|
| 78 |
"signature": datasets.Value("string"),
|
| 79 |
"arguments": datasets.Sequence(datasets.Value("string")),
|
| 80 |
-
"entry_fn_name": datasets.Value("string"),
|
| 81 |
-
"entry_cls_name": datasets.Value("string"),
|
| 82 |
-
"test_code": datasets.Value("string"),
|
| 83 |
"source_py": datasets.Value("string"),
|
| 84 |
"source_cpp": datasets.Value("string"),
|
| 85 |
-
"
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
| 87 |
})
|
| 88 |
description = _DESCRIPTION
|
| 89 |
if self.config.name != 'all':
|
|
@@ -118,10 +125,16 @@ class BCTranscoder(datasets.GeneratorBasedBuilder):
|
|
| 118 |
|
| 119 |
if self.config.name != 'all' and d['language'] != self.config.name:
|
| 120 |
continue
|
|
|
|
| 121 |
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
| 125 |
d['source_py'] = d.pop('solution_python')
|
| 126 |
d['source_cpp'] = d.pop('solution_cpp')
|
| 127 |
|
|
|
|
| 48 |
|
| 49 |
_KEYS_REMOVE = {"text", "signature_with_docstring"}
|
| 50 |
|
| 51 |
+
_QUESTION_INFO_KEYS = {
|
| 52 |
+
"entry_fn_name",
|
| 53 |
+
"entry_cls_name",
|
| 54 |
+
"test_code",
|
| 55 |
+
"test_list",
|
| 56 |
+
"test_case_ids",
|
| 57 |
+
}
|
| 58 |
|
| 59 |
class BCTranscoder(datasets.GeneratorBasedBuilder):
|
| 60 |
"""BC-Transcoder"""
|
|
|
|
| 84 |
"language": datasets.Value("string"),
|
| 85 |
"signature": datasets.Value("string"),
|
| 86 |
"arguments": datasets.Sequence(datasets.Value("string")),
|
|
|
|
|
|
|
|
|
|
| 87 |
"source_py": datasets.Value("string"),
|
| 88 |
"source_cpp": datasets.Value("string"),
|
| 89 |
+
"question_info":
|
| 90 |
+
datasets.Features({
|
| 91 |
+
k:datasets.Value(dtype="string")
|
| 92 |
+
for k in _QUESTION_INFO_KEYS
|
| 93 |
+
})
|
| 94 |
})
|
| 95 |
description = _DESCRIPTION
|
| 96 |
if self.config.name != 'all':
|
|
|
|
| 125 |
|
| 126 |
if self.config.name != 'all' and d['language'] != self.config.name:
|
| 127 |
continue
|
| 128 |
+
|
| 129 |
|
| 130 |
+
question_info = {}
|
| 131 |
+
for k in _QUESTION_INFO_KEYS:
|
| 132 |
+
question_info[k] = d.pop(k)
|
| 133 |
|
| 134 |
+
question_info['test_list'] = json.dumps(question_info['test_list'])
|
| 135 |
+
|
| 136 |
+
d['question_info'] = question_info
|
| 137 |
+
|
| 138 |
d['source_py'] = d.pop('solution_python')
|
| 139 |
d['source_cpp'] = d.pop('solution_cpp')
|
| 140 |
|