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

Adding type annotations to manim.utils.* #3999

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

henrikmidtiby
Copy link
Contributor

Overview: What does this pull request change?

The PR adds type annotations to some of the elements in manim/utils

Motivation and Explanation: Why and how do your changes improve the library?

Type annotations are a good thing.

Further Information and Comments

I have chosen to go for smaller PR regarding adding type annotations.
The endeavor of #3981 is a bit frightening...

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@@ -54,10 +56,12 @@
@overload
def bezier(
points: Sequence[Point3D_Array],
) -> Callable[[float | ColVector], Point3D_Array]: ...
) -> Callable[[float | ColVector], Point3D | Point3D_Array]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
def interpolate(start: Point3D, end: Point3D, alpha: float) -> Point3D: ...
def interpolate(
start: InternalPoint3D, end: InternalPoint3D, alpha: float
) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
def interpolate(start: Point3D, end: Point3D, alpha: ColVector) -> Point3D_Array: ...
def interpolate(
start: InternalPoint3D, end: InternalPoint3D, alpha: ColVector
) -> Point3D_Array: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@@ -1099,10 +1115,12 @@


@overload
def mid(start: Point3D, end: Point3D) -> Point3D: ...
def mid(start: InternalPoint3D, end: InternalPoint3D) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
def inverse_interpolate(start: float, end: float, value: Point3D) -> Point3D: ...
def inverse_interpolate(
start: float, end: float, value: InternalPoint3D
) -> InternalPoint3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
def inverse_interpolate(start: Point3D, end: Point3D, value: Point3D) -> Point3D: ...
def inverse_interpolate(
start: InternalPoint3D, end: InternalPoint3D, value: InternalPoint3D
) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
manim/utils/color/core.py Fixed Show fixed Hide fixed
manim/scene/scene_file_writer.py Fixed Show fixed Hide fixed
manim/scene/scene_file_writer.py Fixed Show fixed Hide fixed


def clip(a, min_a, max_a):
@overload
def clip(a: float, min_a: float, max_a: float) -> float: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
def clip(a: str, min_a: str, max_a: str) -> str: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant