From 9dfa5148f8a7c84cb34a50d6cb0a661128877a00 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 08:34:19 +0000 Subject: [PATCH 1/2] fix: use is_file() to avoid treating study-ID directories as CSV paths --- pridepy/pdc/client.py | 4 ++-- pridepy/tests/test_pdc_client.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pridepy/pdc/client.py b/pridepy/pdc/client.py index 3e217ed..275267f 100644 --- a/pridepy/pdc/client.py +++ b/pridepy/pdc/client.py @@ -139,7 +139,7 @@ def parse_accessions(accession: str) -> List[str]: raise ValueError("--accession must not be empty") source_path = Path(accession).expanduser() - if source_path.exists(): + if source_path.is_file(): if source_path.suffix.lower() != ".csv": raise ValueError(f"Only CSV accession files are supported: {source_path}") return _read_accessions_from_csv(source_path) @@ -168,7 +168,7 @@ def parse_download_requests(accession: str, file_type: Optional[str] = None) -> command_file_type = normalize_file_type(file_type) if file_type else None source_path = Path(accession).expanduser() - if source_path.exists(): + if source_path.is_file(): if source_path.suffix.lower() != ".csv": raise ValueError(f"Only CSV accession files are supported: {source_path}") diff --git a/pridepy/tests/test_pdc_client.py b/pridepy/tests/test_pdc_client.py index 472cc0b..5edfe68 100644 --- a/pridepy/tests/test_pdc_client.py +++ b/pridepy/tests/test_pdc_client.py @@ -60,6 +60,17 @@ class TestPDCAccessions(TestCase): def test_single_accession(self): assert parse_accessions("PDC000109") == ["PDC000109"] + def test_accession_not_confused_with_same_named_directory(self): + with tempfile.TemporaryDirectory() as tmp_dir: + old_cwd = os.getcwd() + os.chdir(tmp_dir) + try: + os.makedirs("PDC000714") + assert parse_accessions("PDC000714") == ["PDC000714"] + assert parse_download_requests("PDC000714") == [PDCDownloadRequest("PDC000714", None)] + finally: + os.chdir(old_cwd) + def test_comma_accessions_are_deduped(self): assert parse_accessions("PDC000109,PDC000110,PDC000109") == [ "PDC000109", From 629a1d163bd8afafbda9bd2ca732d117d0a9e529 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 08:38:08 +0000 Subject: [PATCH 2/2] chore: bump version to 0.0.17 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b94d076..e557eec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pridepy" -version = "0.0.16" +version = "0.0.17" description = "Python Client library for PRIDE Rest API" readme = "README.md" requires-python = ">=3.9"