-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adding type annotations to scene.py and vector_space_scene.py #4260
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
henrikmidtiby
wants to merge
22
commits into
ManimCommunity:main
Choose a base branch
from
henrikmidtiby:Typing_scene_take_two
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
22 commits
Select commit
Hold shift + click to select a range
b7dbc94
Stop ignoring errors from manim/scene.py
henrikmidtiby 329e98a
Stop ignoring errors from manim/scene/scene.py
henrikmidtiby 294ea2a
Adding type annotations to scene.py (C1)
henrikmidtiby b8fa2c0
Adding type annotations to scene.py (C2.1)
henrikmidtiby 68d5939
Adding type annotations to scene.py (C2.2)
henrikmidtiby 94a56a0
Adding type annotations to scene.py (C2.3)
henrikmidtiby ca87c16
Adding type annotations to scene.py (C3)
henrikmidtiby f920d03
Adding type annotations to scene.py (C4)
henrikmidtiby 86af814
Adding type annotations to scene.py (C5)
henrikmidtiby 9bfc983
Adding type annotations to scene.py (C6)
henrikmidtiby 591bc77
Adding type annotations to scene.py (C7)
henrikmidtiby 9a8f9bc
...
henrikmidtiby 241ebb0
Focus on scene.py
henrikmidtiby e93dd55
Adding type annotations to vector_space_scene.py
henrikmidtiby 203124f
Added types to opengl_renderer.py
henrikmidtiby 2760cb2
Added types to cairo_renderer.py
henrikmidtiby 5215c9b
Fixed the last mypy errors in scene.py - many was ignored
henrikmidtiby 6a53cc1
Fixed the last mypy errors in vector_space_scene.py - many was ignored
henrikmidtiby d0bb1c0
Got rid of the last mypy errors.
henrikmidtiby 04a437d
Activate mypy check of vector_space_scene.py
henrikmidtiby ce046c4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2e45b3b
Code cleanup.
henrikmidtiby 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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
from typing import Any | ||
|
||
from manim.animation.animation import Animation | ||
from manim.scene.scene import Scene | ||
Check failureCode scanning / CodeQL Module-level cyclic import Error
'Scene' may not be defined if module
manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading import Error loading related location Loading 'Scene' may not be defined if module manim.scene.scene Error loading related location Loading manim.renderer.cairo_renderer Error loading related location Loading definition Error loading related location Loading |
||
|
||
from ..typing import PixelArray | ||
|
||
|
@@ -33,11 +33,11 @@ | |
|
||
def __init__( | ||
self, | ||
file_writer_class=SceneFileWriter, | ||
camera_class=None, | ||
skip_animations=False, | ||
**kwargs, | ||
): | ||
file_writer_class: type[SceneFileWriter] = SceneFileWriter, | ||
camera_class: type[Camera] | None = None, | ||
skip_animations: bool = False, | ||
**kwargs: Any, | ||
) -> None: | ||
# All of the following are set to EITHER the value passed via kwargs, | ||
# OR the value stored in the global config dict at the time of | ||
# _instance construction_. | ||
|
@@ -51,7 +51,7 @@ | |
self.time = 0 | ||
self.static_image = None | ||
|
||
def init_scene(self, scene): | ||
def init_scene(self, scene: Scene) -> None: | ||
self.file_writer: Any = self._file_writer_class( | ||
self, | ||
scene.__class__.__name__, | ||
|
@@ -119,12 +119,12 @@ | |
|
||
def update_frame( # TODO Description in Docstring | ||
self, | ||
scene, | ||
scene: Scene, | ||
mobjects: typing.Iterable[Mobject] | None = None, | ||
include_submobjects: bool = True, | ||
ignore_skipping: bool = True, | ||
**kwargs, | ||
): | ||
**kwargs: Any, | ||
) -> None: | ||
"""Update the frame. | ||
|
||
Parameters | ||
|
@@ -263,7 +263,7 @@ | |
self.skip_animations = True | ||
raise EndSceneEarlyException() | ||
|
||
def scene_finished(self, scene): | ||
def scene_finished(self, scene: Scene) -> None: | ||
# If no animations in scene, render an image instead | ||
if self.num_plays: | ||
self.file_writer.finish() | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
Check failure
Code scanning / CodeQL
Module-level cyclic import Error