Skip to content

Commit 855ea86

Browse files
Add type annotations to opengl_mobject.py (#4398)
* feat(manim.mobject.opengl): added type annotations for `opengl_compatibility.py` * feat(manim.mobject.opengl): typed almost all attribute definitions in `OpenGLMobject.__init__` * feat(manim.mobject.opengl): typed more methods for `OpenGLMobject` * fix(manim.mobject.opengl): import `override` from `typing_extensions` * fix(manim.mobject.opengl): import `Never` from `typing_extensions` * feat(manim.utils.config_ops): made `_Data` descriptor generic, to allow correctly typing `OpenGLMobject` * fix(mypy.ini): don't ignore `manim.mobject.opengl.opengl_mobject` * fix(manim.utils.config_ops): import `TypeVar` from `typing_extensions`, because the `typing` one does not have the `default` argument. * feat(manim.mobject.opengl.opengl_mobject): Type checked more methods in `OpenGLMobject`. * fix(manim.mobject.opengl.opengl_mobject): Fix a typo in `OpenGLMobject.restore`. * feat(manim.mobject.opengl.opengl_mobject): Typed more methods in `OpenGLMobject`. * feat(manim.mobject.opengl.opengl_mobject): Moved `overload`s inside an `if TYPE_CHECKING` statement. * feat(manim.mobject.opengl.opengl_mobject): Added type annotations for `**kwargs` in a set of related methods. * Revert "feat(manim.mobject.opengl): added type annotations for `opengl_compatibility.py`" This reverts commit 1cd1550. * fix(OpenGLMobject): defined `get_array_attrs` method (and typed `_original__init__` at class scope). I followed the advice of an existing `# TODO` comment and the implementation in `Mobject`. This also resolves a mypy error in this class (missing attribute). It's interesting because the `get_array_attrs` method is (was) only defined in three classes: - `Mobject` - `PMobject` - `OpenGLPMobject` * feat(manim.mobject.opengl.opengl_mobject): Added type annotations for the `override_animate()`. * feat(manim.mobject.opengl.opengl_mobject): Added type annotations to `_AnimationBuilder` and some methods in `OpenGLPoint`. * fix(manim.mobject.opengl.opengl_mobject): fix failing tests * fix(OpenGLMobject): default implementation of `pointwise_become_partial(…)` had to return `self`! * feat(OpenGLMobject): added `type: ignore[no-untyped-call]` for calls to `ShaderWrapper` methods (not yet annotated). * feat(OpenGLMobject): annotated shader-related `ClassVar`s * feat(OpenGLMobject): typed several `**kwargs` and added `type: ignore[no-any-return]`s for cases where mypy cannot understand operations on numpy arrays. * feat(OpenGLMobject): typed more `**kwargs` and fixed `set_color` arguments * feat(OpenGLMobject): Added more type annotations. * feat(OpenGLMobject): Typed `OpenGLMobject.uniforms` and `OpenGLMobject.fixed_orientation_center` * fix(OpenGLMobject): fix tests * fix(OpenGLGroup): annotate `**kwargs` * fix(OpenGLPoint): annotate `**kwargs` * fix(OpenGLPoint): corrected `**kwargs` and removed two `type: ignore`s * fix(OpenGLPoint): removed `# type: ignore[no-untyped-call]`s * fix(ci): import `Self` from `typing_extensions` rather than `typing`. * fix(ci): import `TypeAlias` from `typing_extensions` rather than `typing`. * feat(OpenGLMobject): make use of PEP 728. * fix(ci): update `typing-extensions` requirement to the first version that supports PEP 728. * fix(OpenGLMobject): avoid variable redefinitions in the `arrange_in_grid` method. * fix(mypy.ini): remove unused changes to `mypy` configuration. * fix(OpenGLMobject): use different symbols for the two `updater` variables. * Revert "fix(ci): update `typing-extensions` requirement to the first version that supports PEP 728." This reverts commit 69b96c6. * fix(OpenGLMobject): remove `TypedDict`s and switch to the less precise `**kwargs: Any`. * Handle three no-any-return issues. * Removed the slash divider in function parameters * Removed the slash divider in function parameters * Keep a single slash divider - to make return types match --------- Co-authored-by: Henrik Skov Midtiby <henrikmidtiby@gmail.com>
1 parent 8535d06 commit 855ea86

File tree

5 files changed

+363
-230
lines changed

5 files changed

+363
-230
lines changed

0 commit comments

Comments
 (0)