From b30130ffc01161bfa28bbbce5f0729d4a1e93de3 Mon Sep 17 00:00:00 2001 From: Leopold MAYTIE Date: Wed, 16 Jul 2025 12:28:01 +0200 Subject: [PATCH 1/4] Add ckpturl argument in download function --- simple_shapes_dataset/cli/download.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/simple_shapes_dataset/cli/download.py b/simple_shapes_dataset/cli/download.py index cb82123..835bafa 100644 --- a/simple_shapes_dataset/cli/download.py +++ b/simple_shapes_dataset/cli/download.py @@ -47,11 +47,21 @@ def downlad_file(url: str, path: Path): "Useful if you need the old version of the dataset." ), ) -def download_dataset(path: Path, force: bool, no_migration: bool): +@click.option( + "--ckpturl", + default=DATASET_URL, + help="Dataset URL. Defaults to `https://zenodo.org/records/8112838/files/simple_shapes_dataset.tar.gz`", +) +@click.option( + "--name", + default="simple_shapes_dataset", + help="name of the folder to download. Defaults to `simple_shapes_dataset`", +) +def download_dataset(path: Path, force: bool, no_migration: bool, ckpturl: str = DATASET_URL, name: str = "simple_shapes_dataset"): click.echo(f"Downloading in {str(path)}.") - dataset_path = path / "simple_shapes_dataset" - archive_path = path / "simple_shapes_dataset.tar.gz" + dataset_path = path / name + archive_path = path / f"{name}.tar.gz" if dataset_path.exists() and not force: click.echo( "Dataset already exists. Skipping download. " @@ -61,7 +71,7 @@ def download_dataset(path: Path, force: bool, no_migration: bool): elif dataset_path.exists(): click.echo("Dataset already exists. Re-downloading.") shutil.rmtree(dataset_path) - downlad_file(DATASET_URL, archive_path) + downlad_file(ckpturl, archive_path) click.echo("Extracting archive...") with tarfile.open(archive_path, "r:gz") as archive: archive.extractall(path) From 4f6a27cd7e891e879155299b729e615ac69b3995 Mon Sep 17 00:00:00 2001 From: Leopold MAYTIE Date: Wed, 16 Jul 2025 12:30:46 +0200 Subject: [PATCH 2/4] Ruff formatting --- simple_shapes_dataset/cli/download.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/simple_shapes_dataset/cli/download.py b/simple_shapes_dataset/cli/download.py index 835bafa..dbfabce 100644 --- a/simple_shapes_dataset/cli/download.py +++ b/simple_shapes_dataset/cli/download.py @@ -50,14 +50,23 @@ def downlad_file(url: str, path: Path): @click.option( "--ckpturl", default=DATASET_URL, - help="Dataset URL. Defaults to `https://zenodo.org/records/8112838/files/simple_shapes_dataset.tar.gz`", + help=( + "Dataset URL. Defaults to " + "`https://zenodo.org/records/8112838/files/simple_shapes_dataset.tar.gz`", + ), ) @click.option( "--name", default="simple_shapes_dataset", help="name of the folder to download. Defaults to `simple_shapes_dataset`", ) -def download_dataset(path: Path, force: bool, no_migration: bool, ckpturl: str = DATASET_URL, name: str = "simple_shapes_dataset"): +def download_dataset( + path: Path, + force: bool, + no_migration: bool, + ckpturl: str = DATASET_URL, + name: str = "simple_shapes_dataset" +): click.echo(f"Downloading in {str(path)}.") dataset_path = path / name From fe016f8a978c4292e31944fb565b7d78ca375c80 Mon Sep 17 00:00:00 2001 From: Leopold MAYTIE Date: Wed, 16 Jul 2025 12:46:56 +0200 Subject: [PATCH 3/4] ruff formatting --- simple_shapes_dataset/cli/download.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_shapes_dataset/cli/download.py b/simple_shapes_dataset/cli/download.py index dbfabce..d92cf12 100644 --- a/simple_shapes_dataset/cli/download.py +++ b/simple_shapes_dataset/cli/download.py @@ -65,7 +65,7 @@ def download_dataset( force: bool, no_migration: bool, ckpturl: str = DATASET_URL, - name: str = "simple_shapes_dataset" + name: str = "simple_shapes_dataset", ): click.echo(f"Downloading in {str(path)}.") From 011ccef9fe11af5350e58db0f50722ef273e4533 Mon Sep 17 00:00:00 2001 From: Leopold MAYTIE Date: Wed, 16 Jul 2025 12:51:54 +0200 Subject: [PATCH 4/4] debug ckpturl flag --- simple_shapes_dataset/cli/download.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_shapes_dataset/cli/download.py b/simple_shapes_dataset/cli/download.py index d92cf12..2123ff4 100644 --- a/simple_shapes_dataset/cli/download.py +++ b/simple_shapes_dataset/cli/download.py @@ -52,7 +52,7 @@ def downlad_file(url: str, path: Path): default=DATASET_URL, help=( "Dataset URL. Defaults to " - "`https://zenodo.org/records/8112838/files/simple_shapes_dataset.tar.gz`", + "`https://zenodo.org/records/8112838/files/simple_shapes_dataset.tar.gz`" ), ) @click.option(