Skip to content

Commit 8546049

Browse files
authored
Merge pull request #114 from PRIDE-Archive/dev
Minor changes for existing folders projects.
2 parents 811e106 + d5fc49a commit 8546049

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

pridepy/pdc/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def parse_accessions(accession: str) -> List[str]:
139139
raise ValueError("--accession must not be empty")
140140

141141
source_path = Path(accession).expanduser()
142-
if source_path.exists():
142+
if source_path.is_file():
143143
if source_path.suffix.lower() != ".csv":
144144
raise ValueError(f"Only CSV accession files are supported: {source_path}")
145145
return _read_accessions_from_csv(source_path)
@@ -168,7 +168,7 @@ def parse_download_requests(accession: str, file_type: Optional[str] = None) ->
168168
command_file_type = normalize_file_type(file_type) if file_type else None
169169
source_path = Path(accession).expanduser()
170170

171-
if source_path.exists():
171+
if source_path.is_file():
172172
if source_path.suffix.lower() != ".csv":
173173
raise ValueError(f"Only CSV accession files are supported: {source_path}")
174174

pridepy/tests/test_pdc_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ class TestPDCAccessions(TestCase):
6060
def test_single_accession(self):
6161
assert parse_accessions("PDC000109") == ["PDC000109"]
6262

63+
def test_accession_not_confused_with_same_named_directory(self):
64+
with tempfile.TemporaryDirectory() as tmp_dir:
65+
old_cwd = os.getcwd()
66+
os.chdir(tmp_dir)
67+
try:
68+
os.makedirs("PDC000714")
69+
assert parse_accessions("PDC000714") == ["PDC000714"]
70+
assert parse_download_requests("PDC000714") == [PDCDownloadRequest("PDC000714", None)]
71+
finally:
72+
os.chdir(old_cwd)
73+
6374
def test_comma_accessions_are_deduped(self):
6475
assert parse_accessions("PDC000109,PDC000110,PDC000109") == [
6576
"PDC000109",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pridepy"
3-
version = "0.0.16"
3+
version = "0.0.17"
44
description = "Python Client library for PRIDE Rest API"
55
readme = "README.md"
66
requires-python = ">=3.9"

0 commit comments

Comments
 (0)