Skip to content

STY: Reorder filters in decode_stream_data #3289

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

j-t-1
Copy link
Contributor

@j-t-1 j-t-1 commented May 20, 2025

Use same order as they are described in the PDF specification. Plus some small changes to comments.

j-t-1 added 2 commits May 20, 2025 13:20
Use same order as they are described in the PDF specification. Plus some small changes to comments.
Use same order as they are described in the PDF specification. Plus some small changes to comments.
Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.71%. Comparing base (15c42ff) to head (05724e4).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3289      +/-   ##
==========================================
+ Coverage   96.69%   96.71%   +0.01%     
==========================================
  Files          53       53              
  Lines        9024     9028       +4     
  Branches     1674     1674              
==========================================
+ Hits         8726     8731       +5     
- Misses        176      177       +1     
+ Partials      122      120       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if decode_parms:
try:
predictor = decode_parms.get("/Predictor", 1)
except (AttributeError, TypeError): # Type Error is NullObject
pass # Usually an array with a null object was read
# predictor 1 == no predictor
# predictor == 1: no predictor
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the old comment was more clear here.

pypdf/filters.py Outdated
@@ -152,6 +147,7 @@ def decode(
colors = cast(int, decode_parms[LZW.COLORS].get_object()) # type: ignore
except (TypeError, KeyError):
colors = 1
DEFAULT_BITS_PER_COMPONENT = 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

Defining this inside the method seems odd at all. I would propose making this an internal class-level constant instead.

@stefan6419846 stefan6419846 added the needs-change The PR/issue cannot be handled as issue and needs to be improved label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-change The PR/issue cannot be handled as issue and needs to be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants