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

Skip to content

Commit eaa97fb

Browse files
committed
Mypy type ignore in pyplot
1 parent 97ad790 commit eaa97fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,10 +1203,11 @@ def sca(ax: Axes) -> None:
12031203
"""
12041204
Set the current Axes to *ax* and the current Figure to the parent of *ax*.
12051205
"""
1206-
figure(ax.figure)
12071206
# Mypy sees ax.figure as potentially None,
12081207
# but if you are calling this, it won't be None
1209-
ax.figure.sca(ax) # type: ignore
1208+
# Additionally the slight difference between `Figure` and `FigureBase` mypy catches
1209+
figure(ax.figure) # type: ignore[arg-type]
1210+
ax.figure.sca(ax) # type: ignore[union-attr]
12101211

12111212

12121213
def cla() -> None:

0 commit comments

Comments
 (0)