Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Description
Bug summary
Type checkers complain when one uses a function that returnsNone
as the parameter ofFuncAnimation
. However, whenblit=False
, the return value of the function is ignored.
Code for reproduction
importmatplotlib.pyplotaspltfrommatplotlibimportrcfrommatplotlib.animationimportFuncAnimationrc("animation",html="jshtml")fig,ax=plt.subplots()defupdate(frame:int)->None:ax.plot([0,1], [frame,frame])FuncAnimation(fig,update,range(10))
Actual outcome
MyPy saysArgument 2 to "FuncAnimation" has incompatible type "Callable[[int], None]"; expected "Callable[..., Iterable[Artist]]"
, but the code executes without problems.
Expected outcome
No MyPy error.
Additional information
I think is possible to allow functions that return arbitraryobject
by combiningoverload
andLiteral[True]
/Literal[False]
for theblit
argument.
Operating system
Any
Matplotlib Version
3.10.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
pip