Skip to content

Commit bfc2b1a

Browse files
QuLogicmeeseeksmachine
authored andcommitted
Backport PR matplotlib#30119: Add some types to _mathtext.py
1 parent d72667f commit bfc2b1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,10 +2521,10 @@ def subsuper(self, s: str, loc: int, toks: ParseResults) -> T.Any:
25212521
if len(new_children):
25222522
# remove last kern
25232523
if (isinstance(new_children[-1], Kern) and
2524-
hasattr(new_children[-2], '_metrics')):
2524+
isinstance(new_children[-2], Char)):
25252525
new_children = new_children[:-1]
25262526
last_char = new_children[-1]
2527-
if hasattr(last_char, '_metrics'):
2527+
if isinstance(last_char, Char):
25282528
last_char.width = last_char._metrics.advance
25292529
# create new Hlist without kerning
25302530
nucleus = Hlist(new_children, do_kern=False)
@@ -2600,7 +2600,7 @@ def subsuper(self, s: str, loc: int, toks: ParseResults) -> T.Any:
26002600

26012601
# Do we need to add a space after the nucleus?
26022602
# To find out, check the flag set by operatorname
2603-
spaced_nucleus = [nucleus, x]
2603+
spaced_nucleus: list[Node] = [nucleus, x]
26042604
if self._in_subscript_or_superscript:
26052605
spaced_nucleus += [self._make_space(self._space_widths[r'\,'])]
26062606
self._in_subscript_or_superscript = False

0 commit comments

Comments
 (0)