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

Unbound & undocumented instance methods in pdf.py (getRectangle, setRectangle, deleteRectangle, createRectangleAccessor) #517

Closed
vinay-deshmukh opened this issue Sep 28, 2019 · 2 comments

Comments

@vinay-deshmukh
Copy link

I was reading the source code of PdfFileReader class PyPDF2/pdf.py
and have found some methods which look like they were meant to be defined within a class, since they take self as a parameter. I initially thought they were somehow accidentally unindented from the PdfFileReader class, but on further searching, I found that these methods aren't even documented on the documentation site.

Given below, are permalinks to the offending functions.

https://github.com/mstamy2/PyPDF2/blob/18a2627adac13124d4122c8b92aaa863ccfb8c29/PyPDF2/pdf.py#L2119

https://github.com/mstamy2/PyPDF2/blob/18a2627adac13124d4122c8b92aaa863ccfb8c29/PyPDF2/pdf.py#L2135

https://github.com/mstamy2/PyPDF2/blob/18a2627adac13124d4122c8b92aaa863ccfb8c29/PyPDF2/pdf.py#L2141

https://github.com/mstamy2/PyPDF2/blob/18a2627adac13124d4122c8b92aaa863ccfb8c29/PyPDF2/pdf.py#L2145

Maybe these methods were to be removed, and weren't.

Anyways, I thought to make an issue since this doesn't seem an intentional feature.

@MartinThoma
Copy link
Member

Thank you - I will keep that in mind for PyPDF2 2.0 : #752

@MartinThoma
Copy link
Member

They are used for createRectangleAccessor of the Page object. We have four types of rectangles:

  • CropBox
  • BleedBox
  • TrimBox
  • ArtBox

Those methods should be private (have a leading _, hence _getRectangle, _setRectangle, ...). But the fact that the first argument is called self is fine.

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

No branches or pull requests

2 participants