in nl2sql/datasets/standard.py [0:0]
def __init__(self) -> None:
"""
Method to auomatically download and
set up the Spider dataset
"""
if not (
os.path.exists(
os.path.join(self.temp_extracted_loc, "spider", "train_spider.json")
)
or os.path.exists(
os.path.join(self.temp_extracted_loc, "spider", "dev.json")
)
or os.path.exists(
os.path.join(self.temp_extracted_loc, "spider", "database")
)
):
if not os.path.exists(self.temp_extracted_loc):
os.makedirs(self.temp_extracted_loc)
temp_zipfile_path = os.path.join(self.temp_loc, "spider.zip")
if not os.path.exists(temp_zipfile_path):
storage.Client().get_bucket(self.bucket_name).blob(
self.zipfile_path
).download_to_filename(temp_zipfile_path)
with ZipFile(temp_zipfile_path, "r") as zipped_file:
zipped_file.extractall(path=self.temp_extracted_loc)