diff --git a/src/resdk/resolwe.py b/src/resdk/resolwe.py index f86119f5..1efe7a5d 100644 --- a/src/resdk/resolwe.py +++ b/src/resdk/resolwe.py @@ -474,12 +474,8 @@ def _download_files( directory (defaults to the current working directory). :param files: files to download - :type files: list of file URI :param download_dir: download directory - :type download_dir: string :param custom_file_names: list of file names to save the downloaded files as - :type custom_file_names: list of strings or None - :rtype: None """ if not download_dir: @@ -565,7 +561,7 @@ def _download_files( ) if expected_md5 != computed_md5: raise ValueError( - f"Checksum of downloaded file {actual_file_name} does not match the expected value." + f"Checksum ({computed_md5}) of downloaded file {actual_file_name} does not match the expected value of {expected_md5}." ) def data_usage(self, **query_params): diff --git a/src/resdk/resources/data.py b/src/resdk/resources/data.py index a0df7cec..a24c1eb5 100644 --- a/src/resdk/resources/data.py +++ b/src/resdk/resources/data.py @@ -325,23 +325,17 @@ def files(self, file_name=None, field_name=None): return file_list def download( - self, file_name=None, field_name=None, download_dir=None, custom_file_name=None + self, + file_name: Optional[str] = None, + field_name: Optional[str] = None, + download_dir: Optional[str] = None, + custom_file_name: Optional[str] = None, ): """Download Data object's files and directories. Download files and directories from the Resolwe server to the download directory (defaults to the current working directory). - :param file_name: name of file or directory - :type file_name: string - :param field_name: file or directory field name - :type field_name: string - :param download_dir: download path - :type download_dir: string - :param custom_file_name: custom file name - :type custom_file_name: string - :rtype: None - Data objects can contain multiple files and directories. All are downloaded by default, but may be filtered by name or output field: @@ -349,6 +343,9 @@ def download( * re.data.get(42).download(file_name='alignment7.bam') * re.data.get(42).download(field_name='bam') + If custom_file_name is provided, the file will be saved with that name, + provided that either field_name or file_name is also specified. + """ if file_name and field_name: raise ValueError("Only one of file_name or field_name may be given.")