Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TYP: Add typing on mathtext internals #26541

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 7 commits into from
Aug 31, 2023
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Aug 18, 2023

PR summary

This adds typing to all of _mathtext.py and cuts down mypy --strict errors for it from >400 to 14 (all but one of which are pyparsing issues). As a proof of concept, this applies all type hints inline.

There is also some refactoring to avoid re-using variables with mixed types, and adding more explicit types for some SimpleNamespace. These could be split into separate PRs if desired, but are separate commits at least.

It is based on #26540.

PR checklist

Pyparsing allows you to leave out the parameters (starting from the
left) if they are unused.
mypy rightfully complains that these methods called in the base class
don't exist, so correctly indicate what should be implemented there.

The ABC is not strictly necessary, but it helps with understanding as a
lot of these have code that makes them seem like _not_ an ABC.
Just as enabling the packrat cache occurs on the class overall, so does
the reset.
@oscargus oscargus added this to the v3.8.0 milestone Aug 31, 2023
@ksunden ksunden merged commit 56732ff into matplotlib:main Aug 31, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 31, 2023
@QuLogic QuLogic deleted the mathtext-type branch August 31, 2023 19:03
QuLogic added a commit that referenced this pull request Aug 31, 2023
…541-on-v3.8.x

Backport PR #26541 on branch v3.8.x (TYP: Add typing on mathtext internals)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
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.

3 participants