Type hints in _type1font.py#30187
Open
jkseppan wants to merge 1 commit into
Open
Conversation
QuLogic
reviewed
Jun 26, 2025
|
|
||
| # Fill in the various *Name properties | ||
| if 'FontName' not in prop: | ||
| if not prop['FontName']: |
Member
There was a problem hiding this comment.
Can we be certain that an empty string is not allowed here (and below)?
Comment on lines
-686
to
-691
| index_token = next(tokens) | ||
| if not index_token.is_number(): | ||
| _log.warning( | ||
| f"Parsing encoding: expected number, got {index_token}" | ||
| ) | ||
| continue |
Member
There was a problem hiding this comment.
This previously ignored parsing failures; did you intend to raise here?
QuLogic
reviewed
Jun 26, 2025
1134a34 to
57797eb
Compare
This file now passes `mypy --strict` (but its imports don't). Improve error handling: a new class _ParseError instead of ValueError or RuntimeError. Raise most of the errors from utility functions to simplify the parsing logic. Move FontBBox parsing into a new utility function.
57797eb to
6c045e5
Compare
Member
|
I rebased this and fixed the "easy" comments I made, i.e., the unused bits and the deprecated names. I also updated to the new type syntax. But there are still a couple unanswered questions above. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This file now passes
mypy --strict(but its imports don't).Improve error handling: a new class _ParseError instead of ValueError
or RuntimeError. Raise most of the errors from utility functions to
simplify the parsing logic. Move FontBBox parsing into a new utility
function.