Skip to content
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

Add type hints to animation #3457

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Viicos
Copy link
Member

@Viicos Viicos commented Nov 16, 2023

Part of #3375.

@@ -400,9 +402,9 @@ def construct(self):
def __init__(
self,
vmobject: VMobject,
rate_func: Callable[[float], float] = linear,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should rate_func be passed to super? (i.e. in this case Write). It is currently unused.

self.suspend_mobject_updating: bool = suspend_mobject_updating
self.lag_ratio: float = lag_ratio
self._on_finish: Callable[[Scene], None] = _on_finish
self.run_time = run_time

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute run_time, which was previously defined in subclass
Flash
.
Assignment overwrites attribute run_time, which was previously defined in subclass
TransformAnimations
.
Assignment overwrites attribute run_time, which was previously defined in subclass
TransformAnimations
.
self.lag_ratio: float = lag_ratio
self._on_finish: Callable[[Scene], None] = _on_finish
self.run_time = run_time
self.rate_func = rate_func

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute rate_func, which was previously defined in subclass
AnimationGroup
.
Assignment overwrites attribute rate_func, which was previously defined in subclass
ChangeSpeed
.
self.rate_func = rate_func
self.reverse_rate_function = reverse_rate_function
self.name = name
self.remover = remover

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute remover, which was previously defined in subclass
ShowPassingFlashWithThinningStrokeWidth
.
@Viicos
Copy link
Member Author

Viicos commented Nov 16, 2023

pointwise_become_partial is only available on VMobject, so the type hint is probably invalid here?

def interpolate_submobject(
self,
submobject: Mobject,
starting_submobject: Mobject,
alpha: float,
) -> None:
submobject.pointwise_become_partial(
starting_submobject, *self._get_bounds(alpha)
)

@Viicos Viicos mentioned this pull request Nov 16, 2023
22 tasks
@chopan050 chopan050 added the documentation Improvements or additions to documentation label Dec 21, 2023
@Viicos Viicos mentioned this pull request Jan 3, 2024
@@ -576,6 +576,8 @@
MappingFunction: TypeAlias = Callable[[Point3D], Point3D]
"""A function mapping a `Point3D` to another `Point3D`."""

RateFunc: TypeAlias = Callable[[float], float]

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'RateFunc' is not used.
@JasonGrace2282
Copy link
Member

pointwise_become_partial is only available on VMobject, so the type hint is probably invalid here?

def interpolate_submobject(
self,
submobject: Mobject,
starting_submobject: Mobject,
alpha: float,
) -> None:
submobject.pointwise_become_partial(
starting_submobject, *self._get_bounds(alpha)
)

It would seem so!

@Viicos Viicos marked this pull request as ready for review February 13, 2024 17:13
@Viicos
Copy link
Member Author

Viicos commented Feb 13, 2024

Consider this a first pass. They are still too many mypy errors to actually enable this module. I first want to go over simple modules and I'll come back to this one later.

@JasonGrace2282 JasonGrace2282 added typehints For adding/discussing typehints and removed documentation Improvements or additions to documentation labels Apr 18, 2024
@JasonGrace2282 JasonGrace2282 marked this pull request as draft May 28, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typehints For adding/discussing typehints
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

3 participants