Skip to content

MAINT: small improvements to the pdf backend - #14413

Merged
jkseppan merged 7 commits into
matplotlib:masterfrom
jkseppan:pdf-improve
Jun 5, 2019
Merged

jkseppan merged 7 commits into
matplotlib:masterfrom
jkseppan:pdf-improve

Conversation

@jkseppan

@jkseppan jkseppan commented Jun 2, 2019

Copy link
Copy Markdown
Member

PR Summary

Improve some docstrings and comments, use generators instead of keeping nextFoo style counters

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

jkseppan added 4 commits June 2, 2019 09:03
Instead of the `self.nextFoo` counters. This way the various name
sequences are defined closer together and it's impossible to forget
to increment the counters.
draw_markers has been implemented, draw_line_collection was removed years ago
but draw_quad_mesh could be implemented
and delete a useless comment
Comment thread lib/matplotlib/backends/backend_pdf.py Outdated

self.fontNames = {} # maps filenames to internal font names
self.nextFont = 1 # next free internal font name
self.internalFontName = (Name(f'F{i}') for i in itertools.count(1))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't really mind the API break (it's clearly intended to be a private API), but please add an API change note and make the new APIs private.

Comment thread lib/matplotlib/backends/backend_pdf.py Outdated
----------

id : int
object id of the stream

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
object id of the stream
Object id of the stream.

Generally, parameter descriptions should start with a capital letter and finish with a period, even if they are not complete sentences.

(Also in the following docs).

Comment thread lib/matplotlib/backends/backend_pdf.py Outdated
for `'Creator'`, `'Producer'` and `'CreationDate'`. They
can be removed by setting them to `None`.
"""
self.objectId = itertools.count(1) # consumed by reserveObject

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe better name this

Suggested change
self.objectId = itertools.count(1) # consumed by reserveObject
self._object_id_generator = itertools.count(1) # consumed by reserveObject

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I gave the new names _seq suffixes to keep the lines slightly shorter.

jkseppan added 3 commits June 5, 2019 06:03
and name the new members like _foo_seq to make them obviously private
and to conform to PEP8
The pytest version requirement has changed.
@jkseppan
jkseppan merged commit d19e8c1 into matplotlib:master Jun 5, 2019
@jkseppan
jkseppan deleted the pdf-improve branch June 5, 2019 09:25
@anntzer

anntzer commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

Not a huge deal here, but note that we normally wait for approval from two reviewers (other than the PR author) to merge (except for docs-only changes where one reviewer is enough).

@jkseppan

jkseppan commented Jun 5, 2019 via email

Copy link
Copy Markdown
Member Author

@anntzer

anntzer commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

No worries :)

@QuLogic QuLogic added this to the v3.2.0 milestone Jun 5, 2019
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.

4 participants