Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
fix FuncAnimation class#29968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix FuncAnimation class#29968
Uh oh!
There was an error while loading.Please reload this page.
Conversation
pre-commit.ci autofix |
for more information, seehttps://pre-commit.ci
lib/matplotlib/animation.pyi Outdated
func: Callable[..., Optional[Iterable[Artist]]], | ||
frames: Iterable | int | Callable[[], Generator] | None = ..., | ||
init_func: Optional[Callable[[], Optional[Iterable[Artist]]]] = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You can use just| None
like the others, no need forOptional
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I see, thank you I didn't know that.
pre-commit.ci autofix |
for more information, seehttps://pre-commit.ci
for more information, seehttps://pre-commit.ci
Who's credentials is precommit using to push these commits? If they are the orgs we should turn that off as a security risk (if they are the users I am still worried, but I don't think there is anything we can/should do about it). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please do not merge until the discussion in the linked issue is resolved.
I do not think we should relax the typing in this way.
It's a GitHub App, with a mix of some read and some write permissions. You can find it in Settings->GitHub Apps. |
Let's not solve this by overload, as discussed here#29960 (comment). A simpler fix is#29984. @Lynsoo anyway thanks for the contribution! |
PR summary
Why is this change necessary?
To ensure the update function passed to FuncAnimation matches expected signatures and avoids runtime errors.
What problem does it solve?
It prevents type errors and ensures the animation updates frames correctly without freezing or crashing.
What is the reasoning for this implementation?
FuncAnimation requires different update function return types depending on blit, typing must reflect this to satisfy static checkers and runtime behavior.
Closes#29960
pre-commit.ci autofix
PR checklist