-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
Conversation
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
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 |
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.
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 |
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.
Defining this inside the method seems odd at all. I would propose making this an internal class-level constant instead.
Use same order as they are described in the PDF specification. Plus some small changes to comments.