Skip to content
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

Implement uncompress functionality for PDF files #75

Merged
merged 7 commits into from
Nov 15, 2024
Merged

Conversation

Kaos599
Copy link
Contributor

@Kaos599 Kaos599 commented Nov 15, 2024

Closes #38

  • Added a new uncompress.py script to decompress Flate-encoded content streams in PDF files.
  • Added Uncompress function to README.md.
  • Added Unit tests for uncompress function in tests\test_uncompress.py
  • Modified pyproject.toml to include the I001 rule for Ruff linter to ignore specific linting issues, since it was conflicting with black

@Kaos599
Copy link
Contributor Author

Kaos599 commented Nov 15, 2024

@Lucas-C i have made all the changes.

There is currently one linting issue though, with tests/test_uncompress.py with black

Screenshot 2024-11-15 172628

All Linting tests gets passed when i run them locally or through GitHub codespaces but black fails in the workflow.
I have not been able to diagnose or figure out why it is happening.
Here is a Run that i did.

output: Annotated[
Path,
typer.Argument(
exists=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exists=False,

It can be really useful to override an existing file, I'm not sure this check is needed.
We alread removed it from other subcommands.

Comment on lines +214 to +219
exists=True,
file_okay=True,
dir_okay=False,
writable=False,
readable=True,
resolve_path=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exists=True,
file_okay=True,
dir_okay=False,
writable=False,
readable=True,
resolve_path=True,
dir_okay=False,
exists=True,
resolve_path=True,

Removing the parameters provided that are identical to the default values: https://github.com/fastapi/typer/blob/master/typer/params.py#L301

@Lucas-C
Copy link
Member

Lucas-C commented Nov 15, 2024

I added a couple of commits to please both black & ruff.

I also approved this PR: good job! 👍
The code is clean and the you added a nice unit test.

I made 2 final suggestions because I recently harmonized typer usage in PR #74
buy I think that I will not bother you with that and merge this PR as it is,
and i will perform those minor changes myself 🙂

Thank you very much for your contribution @Kaos599 👍 👍 👍

@Lucas-C Lucas-C merged commit bff4b8e into py-pdf:main Nov 15, 2024
7 checks passed
MartinThoma added a commit that referenced this pull request Dec 8, 2024
## What's new

### New Features (ENH)
- New `booklet` command to adjust offsets and lengths ([PR #77](#77))
- New `uncompress` command ([PR #75](#75))
- New `update-offsets` command to adjust offsets and lengths ([PR #15](#15))
- New `rm` command ([PR #59](#59))
- `metadata`: now also displaying CreationDate, Creator, Keywords & Subject ([PR #73](#73))
- Add warning for out-of-bounds page range in pdfly `cat` command ([PR #58](#58))

### Bug Fixes (BUG)
- `2-up` command, that only showed one page per sheet, on the left side, with blank space on the right ([PR #78](#78))

[Full Changelog](0.3.3...0.4.0)
@Lucas-C
Copy link
Member

Lucas-C commented Dec 8, 2024

This has been released in version 0.4.0: https://pypi.org/project/pdfly/#history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Add an uncompress functionality
2 participants