Skip to content

Commit

Permalink
typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhsmit committed Jan 2, 2024
1 parent 70239df commit 0f2ea50
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hdxms_datasets/datavault.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def fetch_dataset(self, data_id: str) -> bool:

files = ["hdx_spec.yaml", "metadata.yaml"]
optional_files = ["CITATION.cff"]
hdx_spec = None
for f in files + optional_files:
url = urllib.parse.urljoin(dataset_url, f)
response = requests.get(url)
Expand All @@ -103,12 +104,19 @@ def fetch_dataset(self, data_id: str) -> bool:

elif f in files:
raise urllib.error.HTTPError(
url, response.status_code, f"Error for file {f!r}", response.headers, None
url,
response.status_code,
f"Error for file {f!r}",
response.headers, # type: ignore
None,
)

if f == "hdx_spec.yaml":
hdx_spec = yaml.safe_load(response.text)

if hdx_spec is None:
raise ValueError(f"Could not find HDX spec for data_id {data_id!r}")

data_pth = output_pth / "data"
data_pth.mkdir()

Expand All @@ -124,7 +132,7 @@ def fetch_dataset(self, data_id: str) -> bool:
f_url,
response.status_code,
f"Error for data file {filename!r}",
response.headers,
response.headers, # type: ignore
None,
)

Expand Down

0 comments on commit 0f2ea50

Please sign in to comment.