summaryrefslogtreecommitdiff
path: root/src/python/gudhi/datasets
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2021-06-04 12:21:11 +0200
committerHind-M <hind.montassif@gmail.com>2021-06-04 12:21:11 +0200
commitbbe2e25a204be50eb422db71b4cf314b92797d4e (patch)
tree7cd06ec158cfe903373942c892a7908b24b36139 /src/python/gudhi/datasets
parent3ee453718eebc7274b19caef4b79d8ec2754d583 (diff)
Remove checksum_flag parameter and use value of 'file_checksum is not None' instead
Diffstat (limited to 'src/python/gudhi/datasets')
-rw-r--r--src/python/gudhi/datasets/remote.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/python/gudhi/datasets/remote.py b/src/python/gudhi/datasets/remote.py
index 525a7b66..fdd20f74 100644
--- a/src/python/gudhi/datasets/remote.py
+++ b/src/python/gudhi/datasets/remote.py
@@ -39,7 +39,7 @@ def _checksum_sha256(file_path):
sha256_hash.update(buffer)
return sha256_hash.hexdigest()
-def fetch(url, filename, dirname = "remote_datasets", checksum_flag = False, file_checksum = None):
+def fetch(url, filename, dirname = "remote_datasets", file_checksum = None):
"""
Fetch the wanted dataset from the given url and save it in file_path
@@ -51,12 +51,8 @@ def fetch(url, filename, dirname = "remote_datasets", checksum_flag = False, fil
The name to give to downloaded file.
dirname : string
The directory to save the file to. Default is "remote_datasets".
- checksum_flag : boolean
- To set if the user wants the file checksum. Default is 'False'.
- Note that if checksum_flag is set to 'True', the file_checksum must be provided.
file_checksum : string
The file checksum using sha256 to check against the one computed on the downloaded file.
- To be considered, checksum_flag must be set to 'True'.
Default is 'None'.
Returns
@@ -71,10 +67,7 @@ def fetch(url, filename, dirname = "remote_datasets", checksum_flag = False, fil
urlretrieve(url, file_path)
- if (checksum_flag):
- if file_checksum is None:
- raise ValueError("The file checksum must be provided - different from None - for the check to be performed.")
-
+ if file_checksum is not None:
checksum = _checksum_sha256(file_path)
if file_checksum != checksum:
raise IOError("{} has a SHA256 checksum : {}, "
@@ -100,5 +93,5 @@ def fetch_spiral_2d(filename = "spiral_2d.csv", dirname = "remote_datasets"):
file_path: string
Full path of the created file.
"""
- return fetch("https://raw.githubusercontent.com/GUDHI/gudhi-data/main/points/spiral_2d.csv", filename, dirname, True,
+ return fetch("https://raw.githubusercontent.com/GUDHI/gudhi-data/main/points/spiral_2d.csv", filename, dirname,
'37530355d980d957c4ec06b18c775f90a91e446107d06c6201c9b4000b077f38')