Add .tar support for datasets (#8963)
This commit is contained in:
1 parent
3fc89994e9
commit
d7bc5d7773
1 file changed
+3
-1
+3
-1
@@ -594,10 +594,12 @@ def download(url, dir='.', unzip=True, delete=True, curl=False, threads=1, retry
|
|||||||
else:
|
else:
|
||||||
LOGGER.warning(f'Failed to download {url}...')
|
LOGGER.warning(f'Failed to download {url}...')
|
||||||
|
|
||||||
if unzip and success and f.suffix in ('.zip', '.gz'):
|
if unzip and success and f.suffix in ('.zip', '.tar', '.gz'):
|
||||||
LOGGER.info(f'Unzipping {f}...')
|
LOGGER.info(f'Unzipping {f}...')
|
||||||
if f.suffix == '.zip':
|
if f.suffix == '.zip':
|
||||||
ZipFile(f).extractall(path=dir) # unzip
|
ZipFile(f).extractall(path=dir) # unzip
|
||||||
|
elif f.suffix == '.tar':
|
||||||
|
os.system(f'tar xf {f} --directory {f.parent}') # unzip
|
||||||
elif f.suffix == '.gz':
|
elif f.suffix == '.gz':
|
||||||
os.system(f'tar xfz {f} --directory {f.parent}') # unzip
|
os.system(f'tar xfz {f} --directory {f.parent}') # unzip
|
||||||
if delete:
|
if delete:
|
||||||
|
|||||||
Reference in new issue
Block a user