Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: FuncAnimation function not typed properly #29960

Closed
@vnmabus

Description

@vnmabus

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp