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

MAINT: dviread refactoring #5177

Merged
merged 8 commits into from
Oct 12, 2015
Merged

Conversation

jkseppan
Copy link
Member

@jkseppan jkseppan commented Oct 4, 2015

Use some more modern Python idioms such as context managers and named tuples. Replace the big if-elif block with a table of function objects, adding a little bit of complexity in the form of a decorator but removing a lot of repeated code along with the elifs. Make the code PEP8 compliant.

Available in Python 2.6 and up.
so files get closed automatically

Available in Python 2.5 and up
This should exercise the most important parts.
Replace the massive if-elif block with a list of functions indexed
by opcode. Use a decorator (new in Python 2.4) to register the
functions in the dispatch table and to factor out the repeated
checks for correct parser state and argument reading.
Hide the dispatch table from sphinx, and improve the docstring
for Dvi.
@tacaswell tacaswell added this to the proposed next point release (2.1) milestone Oct 4, 2015
@mdboom
Copy link
Member

mdboom commented Oct 6, 2015

Definite improvement. Nice to have some lower-level unit tests on this stuff, too. Are there any usetex tests in the regular suite that confirm this hasn't change behavior?

@jkseppan
Copy link
Member Author

jkseppan commented Oct 6, 2015

I don't think there are usetex tests in lib/matplotlib/tests except for some for the PS backend.
There are several usetex examples in the examples directory, but do those get run as part of the test suite?

@jenshnielsen
Copy link
Member

@jkseppan We build the examples as part of the automatic docs build but there is no verification of output so they only act as smoke tests

This passes on the current master as well as this branch.
For whatever reason, the svg backend has trouble rendering the test case.
mdboom added a commit that referenced this pull request Oct 12, 2015
@mdboom mdboom merged commit b3290d4 into matplotlib:master Oct 12, 2015
@jkseppan jkseppan deleted the dviread-modernization branch October 13, 2015 17:49
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