Skip to content

Commit

Permalink
Pre-release v0.7.6 (#85)
Browse files Browse the repository at this point in the history
* Replace pkg_resources deprecated package with importlib.pkg_resources
* Update ALL tab button label (PR #84 by @mathdugre)
  • Loading branch information
yohanchatelain authored May 23, 2024
1 parent 01d5662 commit a720312
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions ppmi_downloader/ppmi_downloader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import getpass
import importlib.resources
import json
import os
import os.path as op
Expand All @@ -12,7 +13,6 @@
from typing import List, Optional

import pandas as pd
import pkg_resources
import tqdm
from bs4 import BeautifulSoup
from packaging import version
Expand Down Expand Up @@ -256,13 +256,15 @@ def _get_real_name(self) -> None:
Initialize the attribute mapping guessed names from
crawling PPMI to actual downloaded files.
"""
cache_file = pkg_resources.resource_filename(
"ppmi_downloader", "guessed_to_real.json"

cache_file = (
importlib.resources.files("ppmi_downloader") / "guessed_to_real.json"
)

with open(cache_file, "r", encoding="utf-8") as fi:
self.guessed_to_real = json.load(fi)
self.real_to_guessed = {v: k for k, v in self.guessed_to_real.items()}
with importlib.resources.as_file(cache_file) as cache_file:
with open(cache_file, "r", encoding="utf-8") as fi:
self.guessed_to_real = json.load(fi)
self.real_to_guessed = {v: k for k, v in self.guessed_to_real.items()}

def init_and_log(self) -> None:
"""
Expand Down Expand Up @@ -371,7 +373,6 @@ def download_imaging_data(
(str(row["PATNO"]), str(row["EVENT_ID"]), str(row["Description"]))
for _, row in cohort.iterrows()
}
print(cohort_metadata)
prev_rows = None
attempts = 0
while attempts < 3:
Expand Down
1 change: 1 addition & 0 deletions ppmi_downloader/ppmi_navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ def Download_StudyData_ALL(self) -> None:
# Need to click on ALL tab first to be able to see all checkboxes
# See screenshots_errors/Screenshot_error_ALL_06-12-2023.jpg


self.click_button(
'//*[@id="categoryMenuTree"]//*[@class="ida-studyData-category"][text()="ALL"]',
debug_name="ALL tab",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "ppmi_downloader"
version = "0.7.5"
version = "0.7.6"
description = "A downloader of PPMI files."
authors = [{ name = "Tristan Glatard", email = "[email protected]" }]
readme = "README.md"
Expand Down

0 comments on commit a720312

Please sign in to comment.