Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

LGTM Error Fix (#2001)

GameDungeon9a98d67dd459
diff --git a/lgtm.yml b/lgtm.yml
new file mode 100644
index 000000000..e14c831a5
--- /dev/null
+++ b/lgtm.yml
@@ -0,0 +1,6 @@
+queries:
+ - exclude: py/init-calls-subclass
+ - exclude: py/unexpected-raise-in-special-method
+ - exclude: py/modification-of-locals
+ - exclude: py/multiple-calls-to-init
+ - exclude: py/missing-call-to-init
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
index bd5af10b0..3dd79ca47 100644
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -1102,8 +1102,7 @@ class ManimConfig(MutableMapping):
for qual in constants.QUALITIES:
if all([q[k] == constants.QUALITIES[qual][k] for k in keys]):
return qual
- else:
- return None
+ return None
@quality.setter
def quality(self, qual: str) -> None:
diff --git a/manim/camera/camera.py b/manim/camera/camera.py
index 41df1e2b7..ceedde780 100644
--- a/manim/camera/camera.py
+++ b/manim/camera/camera.py
@@ -187,8 +187,7 @@ class Camera:
for _type in self.display_funcs:
if isinstance(mobject, _type):
return _type
- else:
- raise TypeError(f"Displaying an object of class {_type} is not supported")
+ raise TypeError(f"Displaying an object of class {_type} is not supported")
def reset_pixel_shape(self, new_height, new_width):
"""This method resets the height and width
diff --git a/manim/camera/mapping_camera.py b/manim/camera/mapping_camera.py
index 690639d98..ee23dce3e 100644
--- a/manim/camera/mapping_camera.py
+++ b/manim/camera/mapping_camera.py
@@ -33,7 +33,8 @@ class MappingCamera(Camera):
def points_to_pixel_coords(self, points):
return super().points_to_pixel_coords(
np.apply_along_axis(self.mapping_func, 1, points),
- )
+ ) # TODO: There is an error here, but I don't know how to fix it:
+ # FIXME: Call to method Camera.points_to_pixel_coords with too few arguments; should be no fewer than 3.
def capture_mobjects(self, mobjects, **kwargs):
mobjects = self.get_mobjects_to_display(mobjects, **kwargs)
diff --git a/manim/cli/cfg/group.py b/manim/cli/cfg/group.py
index 8e6ceb14b..c872da941 100644
--- a/manim/cli/cfg/group.py
+++ b/manim/cli/cfg/group.py
@@ -200,8 +200,8 @@ modify write_cfg_subcmd_input to account for it.""",
end="",
)
temp = input()
- else:
- default[key] = temp
+
+ default[key] = temp
default = replace_keys(default) if category == "logger" else default
diff --git a/manim/mobject/changing.py b/manim/mobject/changing.py
index 4aad0bebc..fa0d3c1de 100644
--- a/manim/mobject/changing.py
+++ b/manim/mobject/changing.py
@@ -4,7 +4,6 @@ __all__ = ["AnimatedBoundary", "TracedPath"]
from typing import Callable, Optional
-import numpy as np
from colour import Color
from .._config import config
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index c949793eb..f76655362 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -46,12 +46,7 @@ from ..utils.exceptions import MultiAnimationOverrideException
from ..utils.iterables import list_update, remove_list_redundancies
from ..utils.paths import straight_path
from ..utils.simple_functions import get_parameters
-from ..utils.space_ops import (
- angle_between_vectors,
- normalize,
- rotation_matrix,
- rotation_matrix_transpose,
-)
+from ..utils.space_ops import angle_between_vectors, normalize, rotation_matrix
from .opengl_compatibility import ConvertToOpenGL
# TODO: Explain array_attrs
diff --git a/manim/mobject/opengl_three_dimensions.py b/manim/mobject/opengl_three_dimensions.py
index 9c7f7a67c..dd72878e1 100644
--- a/manim/mobject/opengl_three_dimensions.py
+++ b/manim/mobject/opengl_three_dimensions.py
@@ -1,5 +1,3 @@
-import math
-
import numpy as np
from ..constants import *
diff --git a/manim/mobject/svg/opengl_tex_mobject.py b/manim/mobject/svg/opengl_tex_mobject.py
index f1154d411..a8e8170ee 100644
--- a/manim/mobject/svg/opengl_tex_mobject.py
+++ b/manim/mobject/svg/opengl_tex_mobject.py
@@ -180,7 +180,6 @@ from ...mobject.types.opengl_vectorized_mobject import (
OpenGLVGroup,
)
from ...utils.color import BLACK
-from ...utils.deprecation import deprecated
from ...utils.strings import split_string_list_to_isolate_substrings
from ...utils.tex_file_writing import tex_to_svg_file
from .style_utils import parse_style
diff --git a/manim/mobject/svg/tex_mobject.py b/manim/mobject/svg/tex_mobject.py
index 3bce3c030..3fb2fb4e4 100644
--- a/manim/mobject/svg/tex_mobject.py
+++ b/manim/mobject/svg/tex_mobject.py
@@ -36,7 +36,6 @@ from ...mobject.svg.svg_path import SVGPathMobject
from ...mobject.types.vectorized_mobject import VectorizedPoint, VGroup
from ...utils.color import BLACK, WHITE
from ...utils.deprecation import deprecated_params
-from ...utils.tex import TexTemplate
from ...utils.tex_file_writing import tex_to_svg_file
from .style_utils import parse_style
diff --git a/manim/plugins/import_plugins.py b/manim/plugins/import_plugins.py
index 180b7bb95..0f5d2c565 100644
--- a/manim/plugins/import_plugins.py
+++ b/manim/plugins/import_plugins.py
@@ -37,6 +37,6 @@ for plugin in pkg_resources.iter_entry_points("manim.plugins"):
exec(f"{lst.__name__}=lst")
__all__.append(lst.__name__)
plugins_requested.remove(plugin.name)
-else:
- if plugins_requested != []:
- logger.warning("Missing Plugins: %s", plugins_requested)
+
+if plugins_requested != []:
+ logger.warning("Missing Plugins: %s", plugins_requested)
diff --git a/scripts/dev_changelog.py b/scripts/dev_changelog.py
index 806fb5407..3b515a5d6 100755
--- a/scripts/dev_changelog.py
+++ b/scripts/dev_changelog.py
@@ -48,7 +48,6 @@ import os
import re
from collections import defaultdict
from pathlib import Path
-from posixpath import dirname
from textwrap import dedent, indent
import click