refactor(commands): extract cross-cutting commands from files.py#102
refactor(commands): extract cross-cutting commands from files.py#102ypriverol wants to merge 4 commits into
Conversation
Empty scaffold for the follow-up refactor that extracts cross-cutting commands (download_files_by_url, download_files_by_list, download_px_raw_files) from Files into their own modules. No code moved yet. No behaviour change. Test suite green at 68 passed, 4 skipped.
…roteomexchange.py Moved download_px_raw_files, _normalize_px_xml_url, _parse_px_xml_for_raw_file_urls from Files into commands/proteomexchange.py. Files keeps shim re-exports. Also removed now-unused xml.etree.ElementTree import from files.py. No behaviour change. Test suite green.
Moved download_files_by_list from Files into commands/by_list.py. Files keeps a shim re-export. No behaviour change. Test suite green.
Moved download_files_by_url and its 6 helpers (_extract_pride_accession, _validate_urls_checksums, _http_download_url, _ftp_download_url, _dispatch_url_scheme, _download_single_url) from Files into commands/by_url.py. Files keeps shim re-exports for each. Internal calls to patch-sensitive helpers (_http_download_url, _ftp_download_url, _dispatch_url_scheme, _download_single_url) go through Files.X (lazy import) so existing test patches like patch.object(Files, '_http_download_url') keep intercepting. files.py drops below 1000 LOC. No behaviour change. Test suite green at 68 passed, 4 skipped.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Summary
Follow-up to #101. Extracts the three cross-cutting commands (
download_files_by_url,download_files_by_list,download_px_raw_filesand their helpers) frompridepy/files/files.pyinto a newpridepy/commands/package. No behaviour change.files.pysize: 1254 → 995 LOC (21% reduction). The spec target of <700 LOC was overly optimistic; the remaining 995 is largely backward-compat shims for the ~40 methods that tests patch viaFiles.X. Migrating tests to patch the new modules directly would let the shims be removed, but that's deferred to a separate PR.What moved
Backward compatibility
Files keeps shim staticmethods for every moved function. Tests use
patch.object(Files, "_http_download_url")andpatch.object(Files, "_download_single_url")— both still intercept because the newcommands/by_url.pyinternal helpers route throughFiles.X(lazy import) for the patch-sensitive ones.Tests
68 passed, 4 skipped — same as PR #101 baseline. No assertion changes.
Verification
pridepy download-file-by-name -a MSV000080175 -f params.xmlproduces MD543d87368d705c3f380c1d030b14850c4(matches the pre-refactor baseline).Files._http_download_url,_ftp_download_url,_download_single_url).Base-branch note
This PR targets
refactor/files-py-providers(PR #101) so the diff is small. Once #101 merges to dev, update this PR's base.Test plan
wc -l pridepy/files/files.pyreports < 1000pridepy download-file-by-name -a MSV000080175 -f params.xmlproduces MD543d87368d705c3f380c1d030b14850c4