Skip to content

Commit

Permalink
Other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndevenish committed Nov 5, 2024
1 parent f7f4dc9 commit 3ab83e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dials_data/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import warnings
import zipfile
from pathlib import Path
from typing import Any, Optional, Union
from typing import Any
from urllib.parse import urlparse

import py.path
Expand Down Expand Up @@ -104,7 +104,7 @@ def fetch_dataset(
read_only: bool = False,
verbose: bool = False,
pre_scan: bool = True,
) -> Union[bool, dict[str, Any]]:
) -> bool | dict[str, Any]:
"""Check for the presence or integrity of the local copy of the specified
test dataset. If the dataset is not available or out of date then attempt
to download/update it transparently.
Expand Down Expand Up @@ -280,7 +280,7 @@ class DataFetcher:
"""

def __init__(self, read_only: bool = False, verify: bool = True):
self._cache: dict[str, Optional[Path]] = {}
self._cache: dict[str, Path | None] = {}
self._target_dir: Path = dials_data.datasets.repository_location()
self._read_only: bool = read_only and os.access(self._target_dir, os.W_OK)
self._verify: bool = verify
Expand Down Expand Up @@ -332,7 +332,7 @@ def __call__(self, test_data: str, pathlib=None, **kwargs):
return self.result_filter(result=py.path.local(self._cache[test_data]))
return self.result_filter(result=self._cache[test_data])

def _attempt_fetch(self, test_data: str) -> Optional[Path]:
def _attempt_fetch(self, test_data: str) -> Path | None:
if self._read_only:
hashinfo = fetch_dataset(test_data, pre_scan=True, read_only=True)
else:
Expand Down

0 comments on commit 3ab83e8

Please sign in to comment.