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

Refactor number of pages alias (fix #1090) #1203

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andersonhc
Copy link
Collaborator

e.g. Fixes #0

Checklist:

  • The GitHub pipeline is OK (green),
    meaning that both pylint (static code analyzer) and black (code formatter) are happy with the changes of this PR.

  • A unit test is covering the code added / modified by this PR

  • This PR is ready to be merged

  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder

  • A mention of the change is present in CHANGELOG.md

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

Comment on lines +282 to +284
self.pages: Dict[int, PDFPage] = (
{}
) # array of PDFPage objects starting at index 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.pages: Dict[int, PDFPage] = (
{}
) # array of PDFPage objects starting at index 1
# array of PDFPage objects starting at index 1:
self.pages: Dict[int, PDFPage] = {}

Just a suggestion to make the code clearer

Comment on lines +346 to +347
self._render_args = args
self._render_kwargs = kwargs
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't those attributes be defined in the constructor?

@@ -5158,8 +5175,14 @@ def output(
# Generating .buffer based on .pages:
if self._toc_placeholder:
self._insert_table_of_contents()
if self.str_alias_nb_pages:
Copy link
Member

Choose a reason for hiding this comment

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

Why removing this IF?

Copy link
Collaborator

@gmischler gmischler left a comment

Choose a reason for hiding this comment

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

Alias = "A different name for something"

That's not really what we're dealing with here, at all.

Yes, I know that .str_alias_nb_pages has had that name for like forever, but maybe we shouldn't propagate it to all the internal code dealing with text substitution.
In #1202 I tried to use terminology that describes better what really happens. I probably haven't found the absolute best wording, but it may help as a more reasonable starting point.

Using names that don't actually reflect the purpose of the named elements makes the code really confusing to read and hard to understand. I'm not a native english speaker, but I like to be as precise as possible about those things.

Other than that, I expect the result to "just work"... 😉

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.

3 participants