-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
base: main
Are you sure you want to change the base?
Adding type annotations to manim.utils.* #3999
Conversation
@@ -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
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
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
@@ -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
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
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
|
||
|
||
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
|
||
|
||
@overload | ||
def clip(a: str, min_a: str, max_a: str) -> str: ... |
Check notice
Code scanning / CodeQL
Statement has no effect Note
@JasonGrace2282 Would you take a look at this PR? |
I'll take a look when I find the time. |
@@ -2,20 +2,26 @@ | |||
|
|||
import itertools as it | |||
|
|||
from manim.mobject.mobject import Mobject |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.mobject
manim.utils.family_ops
definition
import
'Mobject' may not be defined if module
manim.mobject.mobject
manim.utils.family_ops
definition
import
|
||
def handle_caching_play(func: Callable[..., None]): | ||
from manim.scene.scene import Scene |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
'Scene' may not be defined if module
manim.scene.scene
manim.utils.caching
definition
import
__all__ = ["scene_classes_from_file"] | ||
|
||
|
||
def get_module(file_name: Path): | ||
def get_module(file_name: Path) -> types.ModuleType: |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
cf40c7c
to
224db6d
Compare
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