From 3561f09c4eb7af064b6213c7f56105b10b008486 Mon Sep 17 00:00:00 2001 From: AlbertDominguez Date: Wed, 11 Dec 2024 17:30:10 +0100 Subject: [PATCH] avoid unnecessary unzipping --- spotiflow/utils/get_file.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spotiflow/utils/get_file.py b/spotiflow/utils/get_file.py index 29c7fd9..99a14e3 100644 --- a/spotiflow/utils/get_file.py +++ b/spotiflow/utils/get_file.py @@ -14,6 +14,7 @@ from six.moves.urllib.parse import urlsplit import numpy as np import zipfile +from pathlib import Path from urllib.request import urlretrieve @@ -594,9 +595,7 @@ def __call__(self, block_num, block_size, total_size): return untar_fpath if extract: - _extract_archive(fpath, datadir, archive_format) - + out_dir = Path(fpath).with_suffix("") + if not out_dir.exists() or download: + _extract_archive(fpath, datadir, archive_format) return fpath - - -# ----------