-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Optionally remove single-child top-level directory from extracted archives #579
feat: Optionally remove single-child top-level directory from extracted archives #579
Conversation
updates: - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](asottile/pyupgrade@v3.10.1...v3.11.0) - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](asottile/reorder-python-imports@v3.10.0...v3.11.0) - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](asottile/reorder-python-imports@v3.10.0...v3.11.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: prassepaul <[email protected]>
@josephine-funken thank you for this great work! there seems to be a merge conflict which needs to be removed first -- if you have any questions how to resolve it feel free to reach out. |
…d-files-if-it-has-only-single-child
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #579 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 52 52
Lines 2337 2348 +11
Branches 582 587 +5
=========================================
+ Hits 2337 2348 +11
☔ View full report in Codecov by Sentry. |
Added functionality to remove top-level directories to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this work!
However I would like to request two changes.
- change the file-handling from copy/remove to move/remove
- the
elif
clause can probably be refactored into the if clause which would hopefully raise coverage to 100%
…d-files-if-it-has-only-single-child # Conflicts: # tests/unit/utils/archives_test.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great clean work! Thanks a lot!
…d-files-if-it-has-only-single-child
Description
Removes top-level directories from extracted files if its only child is a directory.
This top-level directory in the archive is unnecessary and creates longer file paths than needed.
Fixes issue #401
Implemented changes
Dataset.extract()
,dataset_download.extract_dataset()
andutils.archives.extract_archive()
.Type of change
How Has This Been Tested?
tests/utils/archives_test.test_extract_archive_destination_path_None()
test_extract_archive_destination_path_not_None()
Checklist: