Datasets:
Working examples
Browse files
e.py
CHANGED
@@ -32,8 +32,10 @@ _DESCRIPTION = """\
|
|
32 |
An open-source replication of E
|
33 |
"""
|
34 |
|
35 |
-
_N_DATA_FILES =
|
|
|
36 |
_DATA_FILES = ["ethereum_{:02d}.tar".format(i) for i in range(_N_DATA_FILES)]
|
|
|
37 |
|
38 |
|
39 |
class EDataset(datasets.GeneratorBasedBuilder):
|
@@ -69,11 +71,6 @@ class EDataset(datasets.GeneratorBasedBuilder):
|
|
69 |
def _generate_examples(self, archive_iterators, iter_archive):
|
70 |
"""Yields examples."""
|
71 |
for archive_iterator in archive_iterators:
|
72 |
-
for
|
73 |
-
if
|
74 |
-
|
75 |
-
for txt_filepath, txt_f in iter_archive(xz_f):
|
76 |
-
if not txt_filepath.endswith(".txt"):
|
77 |
-
continue
|
78 |
-
idx = f"{xz_filepath}/{txt_filepath}"
|
79 |
-
yield idx, {"text": re.sub("\n\n\n+", "\n\n", txt_f.read().decode("utf-8")).strip()}
|
|
|
32 |
An open-source replication of E
|
33 |
"""
|
34 |
|
35 |
+
_N_DATA_FILES = 17
|
36 |
+
_N_DATA_FILES = 2
|
37 |
_DATA_FILES = ["ethereum_{:02d}.tar".format(i) for i in range(_N_DATA_FILES)]
|
38 |
+
print(_DATA_FILES)
|
39 |
|
40 |
|
41 |
class EDataset(datasets.GeneratorBasedBuilder):
|
|
|
71 |
def _generate_examples(self, archive_iterators, iter_archive):
|
72 |
"""Yields examples."""
|
73 |
for archive_iterator in archive_iterators:
|
74 |
+
for code_path, code_f in archive_iterator:
|
75 |
+
if code_path.endswith(".sol.txt") or code_path.endswith(".sol"):
|
76 |
+
yield code_path, {"text": re.sub("\n\n\n+", "\n\n", code_f.read().decode("utf-8")).strip()}
|
|
|
|
|
|
|
|
|
|
test_e.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from datasets import load_dataset
|
3 |
+
|
4 |
+
logging.basicConfig(level=logging.INFO)
|
5 |
+
|
6 |
+
dataset = load_dataset("./e.py")
|
7 |
+
print(dataset["train"][0])
|
8 |
+
|