Skip to content

Commit 9d3c395

Browse files
committed
fix commit
Signed-off-by: jerome_Hsieh <[email protected]>
1 parent e35a663 commit 9d3c395

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

monai/apps/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ def download_and_extract(
334334
raise NotImplementedError(
335335
f'The file types do not match: url={urlFilenameExtension}, but filepath={FilepathExtenstion}'
336336
)
337-
else:
338-
with tempfile.TemporaryDirectory() as tmp_dir:
339-
if filepath:
340-
filename = filepath
341-
else:
342-
filename = Path(tmp_dir, _basename(url)).resolve()
343-
download_url(url=url, filepath=filename, hash_val=hash_val, hash_type=hash_type, progress=progress)
344-
extractall(filepath=filename, output_dir=output_dir, file_type=file_type, has_base=has_base)
337+
with tempfile.TemporaryDirectory() as tmp_dir:
338+
if filepath:
339+
filename = filepath
340+
else:
341+
filename = Path(tmp_dir, _basename(url)).resolve()
342+
filename = filepath if filepath else Path(tmp_dir, _basename(url)).resolve()
343+
download_url(url=url, filepath=filename, hash_val=hash_val, hash_type=hash_type, progress=progress)
344+
extractall(filepath=filename, output_dir=output_dir, file_type=file_type, has_base=has_base)

0 commit comments

Comments
 (0)