-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PyPDF2 2.0 Changes #859
PyPDF2 2.0 Changes #859
Conversation
Most importantly, the means Python 2.7 no longer needs to get supported
* All of them are removed from the package distributions * Scripts is additionally moved to the cpdf project * Sample_Code is moved to the docs
PdfFileReader and PdfFileMerger no longer have the `overwriteWarnings`. The new behavior is `overwriteWarnings=False`. Additionally, PyPDF2.utils.formatWarning was removed
It's expected that this is a more sensible default for most users.
As support for Python 3.5 and lower was dropped, we can use more modern syntax
This includes adding a type m
Codecov Report
@@ Coverage Diff @@
## main #859 +/- ##
==========================================
- Coverage 82.47% 79.96% -2.52%
==========================================
Files 16 16
Lines 3777 4187 +410
Branches 802 813 +11
==========================================
+ Hits 3115 3348 +233
- Misses 495 664 +169
- Partials 167 175 +8
Continue to review full report at Codecov.
|
In case of invalid extract stream data looking for endstream Closes #301
This PR uses 4 ways to disable checks by mypy: * 74x `typing.cast`: Has no effect on the running code, just on mypy * 161x `typing.Any`: If we tell mypy that a parameter / variable can have any possible type, mypy cannot check anything. * 82x `# type: ignore` * 36x `assert foo is not None`: This can have an effect in running code and should only be used if mypy fails to understand that foo is guaranteed not to be None Those are especially necessary for `.getObject()` calls. If possible, they should be removed. `cast` is preferrable over `# type: ignore` as it gives more information. `assert` should only be used in rare cases. Uncertainties: * `ByteStringObject` vs `TextStringObject`, e.g. for `_authenticateUserPassword` and the functions in `_security` * `ContentStream`: I have no clue what type the stream argument should have Details: * utils.ConvertFunctionsToVirtualList -> _VirtualList * Typeguard was used to verify that the annotated types are correct. There are still some cases where Typeguard fails, but the reason might be that Typeguard does not consider inheritance. * BUG: Potential None attribute access in _reader.getDestinationPageNumber * BUG: _security._alg33_1 : Adding str and bytes argument * STY: Fix typo 'test_get_destination_age_number' * BUG: Field.additionalActions was missing a return statement
Signed-off-by: Matthew Peveler <[email protected]>
See #863 Co-authored-by: Martin Thoma <[email protected]>
This is important for some PyPDF2 developers development workflows. It allows them to compare changes more easily. Additionally, some imports were moved from function-level to module-level. See #865 (comment) Co-authored-by: pubpub-zz <[email protected]>
This allows us to have a simpler user interface for page transformations
Add stacklevel=2 to deprecation warnings
This is `git merge main -s ours`
This PR should probably be merged with a merge-commit, not a squashing commit.
The PR shows the current progress towards the 2.0.0 release. There are individual PRs going into the
dev-2.0.0
branch, e.g. #854