Skip to content

Commit

Permalink
Attempt fix for download issue according to readthedocs/readthedocs.o…
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuederle committed Nov 14, 2024
1 parent d825aa1 commit 85ea0a4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mobgap/data/validation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class ValidationResultLoader:
"""Load the revalidation results either by downloading them or from a local folder."""

VALIDATION_REPO_DATA = "https://raw.githubusercontent.com/mobilise-d/mobgap_validation/{version}"
HTTP_HEADERS: Final = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"

Check failure on line 16 in mobgap/data/validation_results.py

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Ruff (E501)

mobgap/data/validation_results.py:16:121: E501 Line too long (139 > 120)
}

CONDITION_INDEX_COLS: Final[dict[Literal["free_living", "laboratory"], list[str]]] = {
"free_living": [
Expand Down Expand Up @@ -62,6 +65,10 @@ def _base_path(self) -> Union[Path, str]:
return self.result_path / self.sub_folder
return self.sub_folder

@property
def downloader(self):

Check failure on line 69 in mobgap/data/validation_results.py

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Ruff (ANN201)

mobgap/data/validation_results.py:69:9: ANN201 Missing return type annotation for public function `downloader`

Check failure on line 69 in mobgap/data/validation_results.py

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Ruff (D102)

mobgap/data/validation_results.py:69:9: D102 Missing docstring in public method
return pooch.HTTPDownloader(headers=self.HTTP_HEADERS, progressbar=True)

def load_single_results(self, algo_name: str, condition: Literal["free_living", "laboratory"]) -> pd.DataFrame:
"""Load the results for a specific condition."""
if self.result_path is not None:
Expand All @@ -72,8 +79,11 @@ def load_single_results(self, algo_name: str, condition: Literal["free_living",
registry = pooch.retrieve(
f"{self.VALIDATION_REPO_DATA.format(version=self.version)}/results_file_registry.txt",
known_hash=None,
downloader=self.downloader,
)
self.brian.load_registry(registry)
return pd.read_csv(
self.brian.fetch(f"{self.sub_folder}/{condition}/{algo_name}/single_results.csv"),
self.brian.fetch(
f"{self.sub_folder}/{condition}/{algo_name}/single_results.csv", downloader=self.downloader
),
).set_index(self.CONDITION_INDEX_COLS[condition])

0 comments on commit 85ea0a4

Please sign in to comment.