Delete dataset.py
Browse files- dataset.py +0 -73
dataset.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
| 1 |
-
import datasets
|
| 2 |
-
import json
|
| 3 |
-
|
| 4 |
-
class SchemapileConfig(datasets.BuilderConfig):
|
| 5 |
-
def __init__(self, **kwargs):
|
| 6 |
-
super().__init__(**kwargs)
|
| 7 |
-
|
| 8 |
-
class Schemapile(datasets.GeneratorBasedBuilder):
|
| 9 |
-
BUILDER_CONFIGS = [
|
| 10 |
-
SchemapileConfig(name="default", version=datasets.Version("1.0.0"), description="Schemapile dataset"),
|
| 11 |
-
]
|
| 12 |
-
|
| 13 |
-
def _info(self):
|
| 14 |
-
return datasets.DatasetInfo(
|
| 15 |
-
description="Schemapile dataset",
|
| 16 |
-
features=datasets.Features({
|
| 17 |
-
"INFO": {
|
| 18 |
-
"URL": datasets.Value("string"),
|
| 19 |
-
"LICENSE": datasets.Value("string"),
|
| 20 |
-
"PERMISSIVE": datasets.Value("bool"),
|
| 21 |
-
"ID": datasets.Value("string"),
|
| 22 |
-
"FILENAME": datasets.Value("string"),
|
| 23 |
-
},
|
| 24 |
-
"LICENSE": datasets.Value("string"),
|
| 25 |
-
"PERMISSIVE": datasets.Value("bool"),
|
| 26 |
-
"TABLES": datasets.Sequence({
|
| 27 |
-
"TABLE_NAME": datasets.Value("string"),
|
| 28 |
-
"COLUMNS": datasets.Sequence({
|
| 29 |
-
"NAME": datasets.Value("string"),
|
| 30 |
-
"TYPE": datasets.Value("string"),
|
| 31 |
-
"NULLABLE": datasets.Value("bool"),
|
| 32 |
-
"UNIQUE": datasets.Value("bool"),
|
| 33 |
-
"DEFAULT": datasets.Value("string"),
|
| 34 |
-
"CHECKS": datasets.Sequence(datasets.Value("string")),
|
| 35 |
-
"IS_PRIMARY": datasets.Value("bool"),
|
| 36 |
-
"IS_INDEX": datasets.Value("bool"),
|
| 37 |
-
"VALUES": datasets.Value("string"),
|
| 38 |
-
}),
|
| 39 |
-
"PRIMARY_KEYS": datasets.Sequence(datasets.Value("string")),
|
| 40 |
-
"FOREIGN_KEYS": datasets.Sequence({
|
| 41 |
-
"COLUMNS": datasets.Sequence(datasets.Value("string")),
|
| 42 |
-
"FOREIGN_TABLE": datasets.Value("string"),
|
| 43 |
-
"REFERRED_COLUMNS": datasets.Sequence(datasets.Value("string")),
|
| 44 |
-
"ON_DELETE": datasets.Value("string"),
|
| 45 |
-
"ON_UPDATE": datasets.Value("string"),
|
| 46 |
-
}),
|
| 47 |
-
"CHECKS": datasets.Sequence(datasets.Value("string")),
|
| 48 |
-
"INDEXES": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
|
| 49 |
-
}),
|
| 50 |
-
}),
|
| 51 |
-
supervised_keys=None,
|
| 52 |
-
)
|
| 53 |
-
|
| 54 |
-
def _split_generators(self, dl_manager):
|
| 55 |
-
# Support both local and remote (Hub) loading
|
| 56 |
-
data_files = self.config.data_files if hasattr(self.config, "data_files") else None
|
| 57 |
-
if data_files:
|
| 58 |
-
data_path = dl_manager.download_and_extract(data_files["train"] if isinstance(data_files, dict) else data_files)
|
| 59 |
-
else:
|
| 60 |
-
# Default to data.jsonl in repo
|
| 61 |
-
data_path = dl_manager.download_and_extract("data.jsonl")
|
| 62 |
-
return [
|
| 63 |
-
datasets.SplitGenerator(
|
| 64 |
-
name=datasets.Split.TRAIN,
|
| 65 |
-
gen_kwargs={"filepath": data_path},
|
| 66 |
-
),
|
| 67 |
-
]
|
| 68 |
-
|
| 69 |
-
def _generate_examples(self, filepath):
|
| 70 |
-
with open(filepath, encoding="utf-8") as f:
|
| 71 |
-
for idx, line in enumerate(f):
|
| 72 |
-
data = json.loads(line)
|
| 73 |
-
yield idx, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|