diff --git a/docs/md/download.md b/docs/md/download.md index dd41fa1..9a3643b 100644 --- a/docs/md/download.md +++ b/docs/md/download.md @@ -77,3 +77,5 @@ from modflow_devtools.download import download_and_unzip url = f"https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip" download_and_unzip(url, "~/Downloads", delete_zip=True, verbose=True) ``` + +The function's return value is the `Path` the archive was extracted to. \ No newline at end of file diff --git a/modflow_devtools/download.py b/modflow_devtools/download.py index c90ba51..3741f05 100644 --- a/modflow_devtools/download.py +++ b/modflow_devtools/download.py @@ -438,7 +438,7 @@ def download_and_unzip( delete_zip=True, retries=3, verbose=False, -): +) -> Path: """ Download and unzip a zip file from a URL. The filename must be the last element in the URL. @@ -455,6 +455,11 @@ def download_and_unzip( The maximum number of retries for each request verbose : bool Whether to show verbose output + + Returns + ------- + Path + The path to the directory where the zip file was unzipped """ path = Path(path if path else os.getcwd()) @@ -544,3 +549,5 @@ def download_and_unzip( if verbose: print(f"Done downloading and extracting {file_path.name} to {path}") + + return path