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

STY: Move functions within _xobj_to_image to a private module #2182

Merged
merged 3 commits into from
Sep 10, 2023

Conversation

MartinThoma
Copy link
Member

@MartinThoma MartinThoma commented Sep 9, 2023

This PR only moves code. It does not change any logic.

@codecov
Copy link

codecov bot commented Sep 9, 2023

Codecov Report

Patch coverage: 93.38% and no project coverage change.

Comparison is base (5bfbae7) 94.25% compared to head (9309c35) 94.26%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2182   +/-   ##
=======================================
  Coverage   94.25%   94.26%           
=======================================
  Files          42       43    +1     
  Lines        7559     7566    +7     
  Branches     1488     1488           
=======================================
+ Hits         7125     7132    +7     
  Misses        266      266           
  Partials      168      168           
Files Changed Coverage Δ
pypdf/_xobj_image_helpers.py 93.33% <93.33%> (ø)
pypdf/filters.py 95.04% <100.00%> (+0.50%) ⬆️

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

@pubpub-zz
Copy link
Collaborator

Are you sure this will "reduce" the complexity ?
Also In order to ease reading, wouldn't it be better to have also _xobj_to_image in the new file ?

@MartinThoma
Copy link
Member Author

I think nested functions are typically more complex then non-nested ones. And passing parameters explicitly is less complex than using global variables.

In order to ease reading, wouldn't it be better to have also _xobj_to_image in the new file ?

I agree 👍

@MartinThoma
Copy link
Member Author

Ah, damn, if I do that, then it becomes more complicated with PIL (which might not be installed) -.-

This reverts commit 63c5c43.
@MartinThoma MartinThoma merged commit 4e48e89 into main Sep 10, 2023
13 of 14 checks passed
@MartinThoma MartinThoma deleted the sty-_xobj_to_image branch September 10, 2023 08:03
@MartinThoma
Copy link
Member Author

@pubpub-zz I'm not super happy with this PR as I agree that _xobj_to_image should also be in the new module.

However, I think this slightly improves the situation. It does reduce the file size quite a bit and hopefully in a meaningful way: If PRs in future touch often just filters.py or _xobj_image_helpers.py (one, not both at the same time) it was a good PR. Then it made merge conflicts less likely.

If that is not the case or if you're telling me that this made the situation worse for you, I'll undo it.

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.

2 participants