-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add classes MethodWithArgs
, SceneInteractContinue
and SceneInteractRerun
inside new module manim.data_structures
#4315
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chopan050
wants to merge
8
commits into
ManimCommunity:main
Choose a base branch
from
chopan050:data_structures
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b8031a1
Add classes MethodWithArgs, SceneInteractRerun and SceneInteractExit
chopan050 de8c5dd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a7c3a2e
Add missing manim.data_structures file
chopan050 6291c41
Rename SceneInteractExit to SceneInteractContinue and use dataclasses
chopan050 81da8ad
Empty commit
chopan050 1bdb9d1
Revert using @dataclass(slots=True), because Python 3.9 does not supp…
chopan050 faa8eaa
Change order of dataclasses
chopan050 c800f79
Add references to Scene.queue in docstrings
chopan050 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from __future__ import annotations | ||
|
||
from collections.abc import Iterable | ||
from dataclasses import dataclass | ||
from types import MethodType | ||
from typing import Any | ||
|
||
|
||
@dataclass | ||
class MethodWithArgs: | ||
"""Object containing a :attr:`method` which is intended to be called later | ||
with the positional arguments :attr:`args` and the keyword arguments | ||
:attr:`kwargs`. | ||
|
||
Attributes | ||
---------- | ||
method : MethodType | ||
A callable representing a method of some class. | ||
args : Iterable[Any] | ||
Positional arguments for :attr:`method`. | ||
kwargs : dict[str, Any] | ||
Keyword arguments for :attr:`method`. | ||
""" | ||
|
||
__slots__ = ["method", "args", "kwargs"] | ||
|
||
method: MethodType | ||
args: Iterable[Any] | ||
kwargs: dict[str, Any] | ||
|
||
|
||
@dataclass | ||
class SceneInteractContinue: | ||
"""Object which, when encountered in :meth:`~.Scene.interact`, triggers | ||
the end of the scene interaction, continuing with the rest of the | ||
animations, if any. This object can be queued in :attr:`~.Scene.queue` | ||
for later use in :meth:`~.Scene.interact`. | ||
|
||
Attributes | ||
---------- | ||
sender : str | ||
The name of the entity which issued the end of the scene interaction, | ||
such as "gui" or "keyboard". | ||
""" | ||
|
||
__slots__ = ["sender"] | ||
|
||
sender: str | ||
|
||
|
||
class SceneInteractRerun: | ||
"""Object which, when encountered in :meth:`~.Scene.interact`, triggers | ||
the rerun of the scene. This object can be queued in :attr:`~.Scene.queue` | ||
for later use in :meth:`~.Scene.interact`. | ||
|
||
Attributes | ||
---------- | ||
sender : str | ||
The name of the entity which issued the rerun of the scene, such as | ||
"gui", "keyboard", "play" or "file". | ||
kwargs : dict[str, Any] | ||
Additional keyword arguments when rerunning the scene. Currently, | ||
only `"from_animation_number"` is being used, which determines the | ||
animation from which to start rerunning the scene. | ||
""" | ||
|
||
__slots__ = ["sender", "kwargs"] | ||
|
||
def __init__(self, sender: str, **kwargs: Any) -> None: | ||
self.sender = sender | ||
self.kwargs = kwargs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.