diff --git a/src/openscm_zenodo/cli/app.py b/src/openscm_zenodo/cli/app.py index 1585f2e..d3cbac2 100644 --- a/src/openscm_zenodo/cli/app.py +++ b/src/openscm_zenodo/cli/app.py @@ -195,6 +195,10 @@ def upload_files_command( """ Upload files to a Zenodo deposition """ + if files_to_upload is None: + msg = "You must supply some files to upload" + raise ValueError(msg) + zenoodo_interactor = ZenodoInteractor( token=token, zenodo_domain=zenodo_domain, diff --git a/src/openscm_zenodo/zenodo.py b/src/openscm_zenodo/zenodo.py index 6d32569..73984d7 100644 --- a/src/openscm_zenodo/zenodo.py +++ b/src/openscm_zenodo/zenodo.py @@ -8,7 +8,7 @@ import json import logging import os.path -from collections.abc import Iterable +from collections.abc import Collection, Iterable from enum import Enum, auto from pathlib import Path from typing import Any, Optional, Union @@ -499,7 +499,7 @@ def upload_file_to_bucket_url( def upload_files( self, deposition_id: str, - to_upload: Iterable[Path], + to_upload: Collection[Path], tqdm_kwargs: Optional[dict[str, Any]] = None, n_threads: int = 4, ) -> tuple[requests.models.Response, ...]: @@ -610,7 +610,7 @@ def delete_deposition(self, deposition_id: str) -> None: def remove_files( self, deposition_id: str, - to_remove: Iterable[Path], + to_remove: Collection[Path], # # Off until parallelism works # n_threads: int = 4, ) -> tuple[requests.models.Response, ...]: @@ -674,10 +674,12 @@ def remove_files_by_id( The response(s) from the file removal request(s) """ # Wanted to do this in parallel, but weirdly flaky - responses = [ - self.remove_file_id(deposition_id=deposition_id, to_remove_id=file_id) - for file_id in tqdm.tqdm(file_ids_to_remove, desc="Files to remove") - ] + responses = tuple( + [ + self.remove_file_id(deposition_id=deposition_id, to_remove_id=file_id) + for file_id in tqdm.tqdm(file_ids_to_remove, desc="Files to remove") + ] + ) # with concurrent.futures.ThreadPoolExecutor(max_workers=n_threads) as executor: # futures = [ # executor.submit(