Datasets:
SeanNaren
commited on
Commit
·
7e22f87
1
Parent(s):
1f59ce0
Use xopen to load files
Browse files- code_clippy_github.py +3 -3
code_clippy_github.py
CHANGED
@@ -20,6 +20,7 @@ import os
|
|
20 |
|
21 |
|
22 |
import datasets
|
|
|
23 |
from huggingface_hub import HfApi, HfFolder
|
24 |
from datasets.data_files import DataFilesDict
|
25 |
|
@@ -174,9 +175,8 @@ class CodeClippyGithub(datasets.GeneratorBasedBuilder):
|
|
174 |
def _generate_examples(self, files):
|
175 |
key = 0
|
176 |
for file_idx, file in enumerate(files):
|
177 |
-
with
|
178 |
-
|
179 |
-
uncompressed_data = f.readlines()
|
180 |
|
181 |
for batch_idx, code_base in enumerate(uncompressed_data):
|
182 |
j_dict = json.loads(code_base.decode('utf-8'))
|
|
|
20 |
|
21 |
|
22 |
import datasets
|
23 |
+
from datasets.download.streaming_download_manager import xopen
|
24 |
from huggingface_hub import HfApi, HfFolder
|
25 |
from datasets.data_files import DataFilesDict
|
26 |
|
|
|
175 |
def _generate_examples(self, files):
|
176 |
key = 0
|
177 |
for file_idx, file in enumerate(files):
|
178 |
+
with xopen(file, "rb") as f:
|
179 |
+
uncompressed_data = gzip.decompress(f.readlines())
|
|
|
180 |
|
181 |
for batch_idx, code_base in enumerate(uncompressed_data):
|
182 |
j_dict = json.loads(code_base.decode('utf-8'))
|