diff --git a/gemgis/download_gemgis_data.py b/gemgis/download_gemgis_data.py index a999445b..b83f19e2 100644 --- a/gemgis/download_gemgis_data.py +++ b/gemgis/download_gemgis_data.py @@ -23,9 +23,7 @@ import zipfile -def create_pooch(storage_url: str, - files: List[str], - target: str): +def create_pooch(storage_url: str, files: List[str], target: str): """ Create pooch class to fetch files from a website. @@ -51,19 +49,22 @@ def create_pooch(storage_url: str, import pooch except ModuleNotFoundError: raise ModuleNotFoundError( - 'Pooch package is not installed. Use pip install pooch to install the latest version') + "Pooch package is not installed. Use pip install pooch to install the latest version" + ) # Create new pooch - pc = pooch.create(base_url=storage_url, - path=target, - registry={i: None for i in files}) + pc = pooch.create( + base_url=storage_url, path=target, registry={i: None for i in files} + ) return pc -def download_tutorial_data(filename: str, - dirpath: str = '', - storage_url: str = 'https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F'): +def download_tutorial_data( + filename: str, + dirpath: str = "", + storage_url: str = "https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F", +): """ Download the GemGIS data for each tutorial. @@ -83,20 +84,19 @@ def download_tutorial_data(filename: str, """ try: from pooch import HTTPDownloader + download = HTTPDownloader(progressbar=False) except ModuleNotFoundError: raise ModuleNotFoundError( - 'Pooch package is not installed. Use pip install pooch to install the latest version') + "Pooch package is not installed. Use pip install pooch to install the latest version" + ) # Creating pooch object - pooch_data = create_pooch(storage_url=storage_url, - files=[filename], - target=dirpath) + pooch_data = create_pooch(storage_url=storage_url, files=[filename], target=dirpath) # Downloading data to the defined folder - pooch_data.fetch(fname=filename, - downloader=download) + pooch_data.fetch(fname=filename, downloader=download) # Opening zip file and unzip in specified directory - with zipfile.ZipFile(dirpath + filename, 'r') as zip_ref: + with zipfile.ZipFile(dirpath + filename, "r") as zip_ref: zip_ref.extractall(dirpath)