You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that ParserState.font is typed as str only. In that function, it's temporarily replaced by the result from state.fontset.get_sized_alternatives_for_symbol. That is also only typed as returning str, except for in StixFonts, which overrides it with str | int. So mypy thinks it can never be equal to 0 and the right operand is never used.
Changing ParserState.font to str | int then cascades into every method in the base class that uses it, but maybe that's a good thing? But if I'm not mistaken, the fontname is all internal to the Fonts subclasses, so it may be possible to rename these to all str.
Activity
QuLogic commentedon Apr 2, 2026
The problem is that
ParserState.fontis typed asstronly. In that function, it's temporarily replaced by the result fromstate.fontset.get_sized_alternatives_for_symbol. That is also only typed as returningstr, except for inStixFonts, which overrides it withstr | int. So mypy thinks it can never be equal to 0 and the right operand is never used.Changing
ParserState.fonttostr | intthen cascades into every method in the base class that uses it, but maybe that's a good thing? But if I'm not mistaken, the fontname is all internal to theFontssubclasses, so it may be possible to rename these to allstr.mathtext: Fix type inconsistency with fontmaps