Skip to content

Commit 7a794e3

Browse files
Code Cleanup: removing unused imports and global variables (#3620)
* Remove unused import * More security fixes * Remove unused global variable * More fixes * Revert change (actual fix would require some rewrite) * Add exception for edge case to satisfy warning * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Stuff * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d1cf1c5 commit 7a794e3

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

manim/__main__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import sys
4-
53
import click
64
import cloup
75

manim/mobject/mobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,13 +2700,13 @@ def push_self_into_submobjects(self) -> Self:
27002700

27012701
def add_n_more_submobjects(self, n: int) -> Self | None:
27022702
if n == 0:
2703-
return
2703+
return None
27042704

27052705
curr = len(self.submobjects)
27062706
if curr == 0:
27072707
# If empty, simply add n point mobjects
27082708
self.submobjects = [self.get_point_mobject() for k in range(n)]
2709-
return
2709+
return None
27102710

27112711
target = curr + n
27122712
# TODO, factor this out to utils so as to reuse

manim/mobject/opengl/opengl_geometry.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
)
2424

2525
DEFAULT_DOT_RADIUS = 0.08
26-
DEFAULT_SMALL_DOT_RADIUS = 0.04
2726
DEFAULT_DASH_LENGTH = 0.05
2827
DEFAULT_ARROW_TIP_LENGTH = 0.35
2928
DEFAULT_ARROW_TIP_WIDTH = 0.35

manim/mobject/table.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def construct(self):
7474
from manim.mobject.text.tex_mobject import MathTex
7575
from manim.mobject.text.text_mobject import Paragraph
7676

77-
from .. import config
7877
from ..animation.animation import Animation
7978
from ..animation.composition import AnimationGroup
8079
from ..animation.creation import Create, Write

manim/mobject/text/tex_mobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from manim.constants import *
3535
from manim.mobject.geometry.line import Line
3636
from manim.mobject.svg.svg_mobject import SVGMobject
37-
from manim.mobject.types.vectorized_mobject import VectorizedPoint, VGroup, VMobject
37+
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
3838
from manim.utils.tex import TexTemplate
3939
from manim.utils.tex_file_writing import tex_to_svg_file
4040

manim/mobject/types/vectorized_mobject.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,37 @@
2626
)
2727

2828
import numpy as np
29-
import numpy.typing as npt
3029
from PIL.Image import Image
31-
from typing_extensions import Self
3230

31+
from manim import config
32+
from manim.constants import *
33+
from manim.mobject.mobject import Mobject
3334
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
3435
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
3536
from manim.mobject.three_d.three_d_utils import (
3637
get_3d_vmob_gradient_start_and_end_points,
3738
)
38-
39-
from ... import config
40-
from ...constants import *
41-
from ...mobject.mobject import Mobject
42-
from ...utils.bezier import (
39+
from manim.utils.bezier import (
4340
bezier,
4441
get_smooth_handle_points,
4542
integer_interpolate,
4643
interpolate,
4744
partial_bezier_points,
4845
proportions_along_bezier_curve_for_point,
4946
)
50-
from ...utils.color import BLACK, WHITE, ManimColor, ParsableManimColor
51-
from ...utils.iterables import make_even, resize_array, stretch_array_to_length, tuplify
52-
from ...utils.space_ops import rotate_vector, shoelace_direction
47+
from manim.utils.color import BLACK, WHITE, ManimColor, ParsableManimColor
48+
from manim.utils.iterables import (
49+
make_even,
50+
resize_array,
51+
stretch_array_to_length,
52+
tuplify,
53+
)
54+
from manim.utils.space_ops import rotate_vector, shoelace_direction
5355

5456
if TYPE_CHECKING:
57+
import numpy.typing as npt
58+
from typing_extensions import Self
59+
5560
from manim.typing import (
5661
BezierPoints,
5762
CubicBezierPoints,
@@ -1406,6 +1411,9 @@ def point_from_proportion(self, alpha: float) -> Point3D:
14061411
return curve(residue)
14071412

14081413
current_length += length
1414+
raise Exception(
1415+
"Not sure how you reached here, please file a bug report at https://github.com/ManimCommunity/manim/issues/new/choose"
1416+
)
14091417

14101418
def proportion_from_point(
14111419
self,

manim/renderer/opengl_renderer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,6 @@ def interpolate(self, *args, **kwargs):
219219
self.refresh_rotation_matrix()
220220

221221

222-
points_per_curve = 3
223-
224-
225222
class OpenGLRenderer:
226223
def __init__(self, file_writer_class=SceneFileWriter, skip_animations=False):
227224
# Measured in pixel widths, used for vector graphics

0 commit comments

Comments
 (0)