Update aptani2param.py
Browse files- aptani2param.py +5 -3
aptani2param.py
CHANGED
|
@@ -25,13 +25,14 @@ class Aptani2Param(datasets.GeneratorBasedBuilder):
|
|
| 25 |
{
|
| 26 |
"config": datasets.Value("string"),
|
| 27 |
"existed": datasets.Value("bool"),
|
|
|
|
| 28 |
}
|
| 29 |
),
|
| 30 |
homepage="http://aptani.unimore.it/",
|
| 31 |
)
|
| 32 |
|
| 33 |
def _split_generators(self, dl_manager):
|
| 34 |
-
aptani2_url = f"{URL}/
|
| 35 |
downloaded_files = [os.path.join(f"{dl_manager.download_and_extract(aptani2_url)}", self.config.name)]
|
| 36 |
return [
|
| 37 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
|
|
@@ -43,9 +44,10 @@ class Aptani2Param(datasets.GeneratorBasedBuilder):
|
|
| 43 |
flag = True
|
| 44 |
for file in filepath:
|
| 45 |
flag = flag and os.path.exists(file)
|
| 46 |
-
|
| 47 |
yield 0, {"config": filepath[0],
|
| 48 |
-
"existed": flag
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
|
|
|
|
| 25 |
{
|
| 26 |
"config": datasets.Value("string"),
|
| 27 |
"existed": datasets.Value("bool"),
|
| 28 |
+
"file_num": datasets.Value("int32"),
|
| 29 |
}
|
| 30 |
),
|
| 31 |
homepage="http://aptani.unimore.it/",
|
| 32 |
)
|
| 33 |
|
| 34 |
def _split_generators(self, dl_manager):
|
| 35 |
+
aptani2_url = f"{URL}/{self.config.name}.tar.gz"
|
| 36 |
downloaded_files = [os.path.join(f"{dl_manager.download_and_extract(aptani2_url)}", self.config.name)]
|
| 37 |
return [
|
| 38 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
|
|
|
|
| 44 |
flag = True
|
| 45 |
for file in filepath:
|
| 46 |
flag = flag and os.path.exists(file)
|
| 47 |
+
file_num = len(os.listdir(filepath[0]))
|
| 48 |
yield 0, {"config": filepath[0],
|
| 49 |
+
"existed": flag,
|
| 50 |
+
"file_num": file_num,
|
| 51 |
}
|
| 52 |
|
| 53 |
|