Skip to content

Commit 962dc0b

Browse files
committed
Add resource download function
1 parent cd5b884 commit 962dc0b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

hdx/data/hdxobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def update_from_json(self, path: str):
8484

8585
def _read_from_hdx(self, object_type: str, value: str, fieldname: Optional[str] = 'id',
8686
action: Optional[str] = None,
87-
**kwargs) -> Union[Tuple[bool, dict], Tuple[bool, str]]:
87+
**kwargs) -> Tuple[bool, Union[dict, str]]:
8888
"""Makes a read call to HDX passing in given parameter.
8989
9090
Args:
@@ -95,7 +95,7 @@ def _read_from_hdx(self, object_type: str, value: str, fieldname: Optional[str]
9595
**kwargs: Other fields to pass to CKAN.
9696
9797
Returns:
98-
(bool, dict/str): (True/False, HDX object metadata/Error)
98+
Tuple[bool, Union[dict, str]]: (True/False, HDX object metadata/Error)
9999
"""
100100
if not value:
101101
raise HDXError("Empty %s value!" % object_type)

hdx/data/resource.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
import os
77
from os.path import join
8-
from typing import Optional, List
8+
from typing import Optional, List, Tuple
99

1010
from hdx.configuration import Configuration
1111
from hdx.utilities.downloader import download_file
@@ -160,14 +160,14 @@ def delete_datastore(self) -> None:
160160
if not success:
161161
logger.debug(result)
162162

163-
def download(self, path: Optional[str] = None) -> (str, str):
164-
"""Download resource store in provided path or named temporary file if no path given
163+
def download(self, path: Optional[str] = None) -> Tuple[str, str]:
164+
"""Download resource store to provided path or named temporary file if no path given
165165
166166
Args:
167167
path (str): Path to download resource to. Defaults to None.
168168
169169
Returns:
170-
(str, str): (URL downloaded, Path of downloaded file)
170+
Tuple[str, str]: (URL downloaded, Path to downloaded file)
171171
172172
"""
173173
# Download the resource

0 commit comments

Comments
 (0)