Support comma-separated multiple categories in download-all-public-category-files#85
Conversation
📝 WalkthroughWalkthroughThe pull request extends file download functionality to support multiple categories simultaneously. The core method Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoSupport comma-separated multiple categories in category file downloads
WalkthroughsDescription• Support comma-separated multiple categories in download CLI command • Accept both single category string and list in get_all_category_file_list() • Add CLI validation for category names with helpful error messages • Maintain backward compatibility with single category parameter Diagramflowchart LR
CLI["CLI Input: -c RAW,SEARCH"] -- "Parse & Validate" --> Validation["Category Validation"]
Validation -- "Split & Normalize" --> Categories["List of Categories"]
Categories -- "Pass to Method" --> GetFiles["get_all_category_file_list"]
GetFiles -- "Filter by Multiple" --> Results["Combined File Results"]
File Changes1. pridepy/files/files.py
|
Code Review by Qodo
1. Py3.9 union annotation
|
| def get_all_category_file_list( | ||
| self, accession: str, categories: "str | List[str]" | ||
| ) -> List[Dict]: |
There was a problem hiding this comment.
1. Py3.9 union annotation 🐞 Bug ⛯ Reliability
• get_all_category_file_list uses a quoted PEP604 union ("str | List[str]"). While it won’t
crash at import time, any tooling that evaluates annotations (e.g., typing.get_type_hints, some
doc generators) can raise SyntaxError on Python 3.9.
• The project declares Python ^3.9, so this compatibility risk is in-scope for supported runtimes.
• This can break downstream users in otherwise valid environments, especially in type-aware
frameworks and documentation builds.
Agent Prompt
### Issue description
`get_all_category_file_list` uses a quoted PEP604 union annotation (`"str | List[str]"`). On Python 3.9, this can break any runtime/tooling that evaluates annotations (e.g., `typing.get_type_hints`), causing a `SyntaxError`.
### Issue Context
The project declares `python = "^3.9"`, so Python 3.9 is a supported runtime.
### Fix Focus Areas
- pridepy/files/files.py[756-758]
### Suggested change
- Import `Union` from `typing`.
- Change annotation to `Union[str, List[str]]` (or `Sequence[str]` if you want to accept more iterables).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
-c/--categoryoption indownload-all-public-category-filesnow accepts comma-separated values (e.g.-c RAW,SEARCH) to download files from multiple categories in a single commandget_all_category_file_list()accepts either a single category string or a list of categories-c RAW) continue to work as beforeUsage
Test plan
test_get_all_category_file_listpasses (single category still works)test_get_all_category_file_list_multipleverifies multi-category filtering returns correct files from both categoriespytest pridepy/tests/ -v)Summary by CodeRabbit
New Features
Tests