-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Handle dvi font names as ASCII bytestrings #6977
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
705b021
Handle dvi font names as ASCII bytestrings
jkseppan dbc8b9e
Test that the KeyError is raised when the font is missing
jkseppan 93fad55
Mention bytestrings in docstring
jkseppan 4874e4e
Add a helpful note when raising KeyError from dviread.PsFonts
jkseppan a130ba7
Attempted fix for Python 3.4 compatibility
jkseppan 0f0e41a
More python 3.4 compatibility
jkseppan a7b5772
Use numpydoc format for several dviread docstrings
jkseppan 803a96e
Remove useless docstring
jkseppan ec5d80e
Raise a more useful exception
jkseppan fe52808
Remove misleading parentheses from assert
jkseppan aa8c4f6
Simplify parsing with regular expressions
jkseppan 9de07aa
Perhaps simplify further with regular expressions
jkseppan c87b653
Remove useless assert
jkseppan 2e19a61
Fix dvi font name handling in pdf backend
jkseppan 119934a
Separate the handling of dvi fonts in the pdf backend
jkseppan 8fa303f
Simplify enc file parsing
jkseppan 94587b1
Small changes in response to code review
jkseppan 254e3df
Simplify psfonts.map parsing further
jkseppan a8674b3
Try to fix the KeyError test
jkseppan 25a8fed
ENH: make texFontMap a property
tacaswell 92e2c52
Merge pull request #6 from tacaswell/dvi-ascii
jkseppan 5ba21b0
Use file system encoding for the psfonts file name
jkseppan 10135bf
Document minor API changes
jkseppan 6de9813
Explain named group ordering
jkseppan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove misleading parentheses from assert
- Loading branch information
commit fe52808d4381d020eeda95873508766a6db68d91
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -915,7 +915,7 @@ def _register(self, words): | |
|
||
# input must be bytestrings (the file format is ASCII) | ||
for word in words: | ||
assert(isinstance(word, bytes)) | ||
assert isinstance(word, bytes) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, the logic of this function may perhaps be more easily expressed using regexes. |
||
texname, psname = words[:2] | ||
effects, encoding, filename = b'', None, None | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A while ago where was an effort to remove
assert
from all of the main code base and replace withif not ...: raise
blocks. Are these here for testing reasons or run-time checks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a private function and should only be called from the same class, so if this triggers it's an internal error in the code. While writing this code I felt this was more obvious than the later errors you get from mixing bytestrings and strings, but perhaps this is not really needed.