FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Type hints in _type1font.py by jkseppan · Pull Request #30187 · matplotlib/matplotlib · GitHub

Type hints in _type1font.py - #30187

Open
jkseppan wants to merge 1 commit into
matplotlib:mainfrom
jkseppan:typecheck-type1font
Open

Type hints in _type1font.py#30187
jkseppan wants to merge 1 commit into
matplotlib:mainfrom
jkseppan:typecheck-type1font

Conversation

Copy link
Copy Markdown
Member

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.

tacaswell added this to the v3.11.0 milestone Jun 19, 2025
Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated

# Fill in the various *Name properties
if 'FontName' not in prop:
if not prop['FontName']:

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we be certain that an empty string is not allowed here (and below)?

Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated
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

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This previously ignored parsing failures; did you intend to raise here?

Comment thread lib/matplotlib/_type1font.py Outdated
Comment thread lib/matplotlib/_type1font.py Outdated
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.
QuLogic force-pushed the typecheck-type1font branch from 57797eb to 6c045e5 Compare June 30, 2026 07:25

QuLogic commented Jun 30, 2026

Copy link
Copy Markdown
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL