Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add type annotations to `opengl_compatibility.py` (#4585)

F. Muenkel6e9ec60b6fe7
diff --git a/manim/mobject/opengl/opengl_compatibility.py b/manim/mobject/opengl/opengl_compatibility.py
index 94991d544..761cd3291 100644
--- a/manim/mobject/opengl/opengl_compatibility.py
+++ b/manim/mobject/opengl/opengl_compatibility.py
@@ -1,6 +1,7 @@
from __future__ import annotations
from abc import ABCMeta
+from typing import Any
from manim import config
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
@@ -19,13 +20,15 @@ class ConvertToOpenGL(ABCMeta):
on the lowest order inheritance classes such as Mobject and VMobject.
"""
- _converted_classes = []
+ _converted_classes: list[type] = []
- def __new__(mcls, name, bases, namespace):
+ def __new__(
+ mcls, name: str, bases: tuple[type, ...], namespace: dict[str, Any]
+ ) -> type:
if config.renderer == RendererType.OPENGL:
# Must check class names to prevent
# cyclic importing.
- base_names_to_opengl = {
+ base_names_to_opengl: dict[str, type] = {
"Mobject": OpenGLMobject,
"VMobject": OpenGLVMobject,
"PMobject": OpenGLPMobject,
@@ -40,6 +43,6 @@ class ConvertToOpenGL(ABCMeta):
return super().__new__(mcls, name, bases, namespace)
- def __init__(cls, name, bases, namespace):
+ def __init__(cls, name: str, bases: tuple[type, ...], namespace: dict[str, Any]):
super().__init__(name, bases, namespace)
cls._converted_classes.append(cls)
diff --git a/mypy.ini b/mypy.ini
index fa00d6afc..fa87f4cde 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -88,9 +88,6 @@ ignore_errors = True
[mypy-manim.mobject.mobject]
ignore_errors = True
-[mypy-manim.mobject.opengl.opengl_compatibility]
-ignore_errors = True
-
[mypy-manim.mobject.opengl.opengl_image_mobject]
ignore_errors = True