Closed
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds zip file support to sum-buddy by enabling checksum generation for both zip files and their individual contents.
- Introduces an ArchiveHandler class to extract zip file contents.
- Updates Mapper to detect zip files and append their internal file paths.
- Modifies Hasher and the main checksum function to handle file-like objects and process files within zip archives.
- Updates README documentation with usage examples for zip file support.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/sumbuddy/mapper.py | Adds detection and processing of zip files and their contents. |
| src/sumbuddy/hasher.py | Renames parameter and adjusts logic to support both file paths and objects. |
| src/sumbuddy/archive.py | Implements ArchiveHandler for zip extraction with temporary directory usage. |
| src/sumbuddy/main.py | Updates get_checksums to include zip file member handling using zipfile APIs. |
| README.md | Documents new zip support and usage examples. |
Comments suppressed due to low confidence (1)
src/sumbuddy/main.py:65
- [nitpick] Consider using a logging mechanism for warnings instead of print statements to allow for configurable output levels and better production diagnostics.
print(f"Warning: {file_in_zip} not found in {zip_path}, skipping.")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cs/sum-buddy into feature/zip-support-new # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Zip File Support
Description
This PR adds support for processing zip files in sum-buddy, allowing users to generate checksums for both zip files and their contents. This feature enhances the package's functionality by enabling comprehensive checksum generation for archived files.
Implementation Details
ArchiveHandlerclass inarchive.pyto manage zip file processingMapperclass to detect and process zip filesHasherclass to handle both file paths and file-like objectsget_checksumsfunction to process both zip files and their contentsTesting
The implementation has been tested with:
Design Decisions
Hasherclass to handle both file paths and file-like objects for better flexibility