Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

flake8: Set max-line-length instead of ignoring long lines (#1948)

Christian Clauss8adae0d4eaf3
diff --git a/.flake8 b/.flake8
index 3d7150aba..78d480a83 100644
--- a/.flake8
+++ b/.flake8
@@ -1,5 +1,8 @@
[flake8]
-max-line-length = 88
+# Exclude the grpc generated code
+exclude = ./.*,manim/grpc/gen/*
+max-complexity = 35
+max-line-length = 250
#Black Compatibility
extend-ignore = E203, E266,
#Style Changes
@@ -10,7 +13,7 @@ extend-ignore = E203, E266,
B006
#Code Changes - Remove later -remove from .pre-commit-config.yaml
- F405, F403, F401, F821, B008, E501, B009, B010, E731
+ F405, F403, F401, F821, B008, B009, B010, E731
#docstring Formatting - Remove Later -remove from .pre-commit-config.yaml
RST304, D400, D401, D205, D105, D103, RST210, RST303, D102, D102, D107, RST212, D200, D100, D101,
@@ -20,5 +23,4 @@ extend-ignore = E203, E266,
#Issue #1148 needs to be closed before removal -remove from .pre-commit-config.yaml
A003,
#Issue #1149 needs to be closed before removal -remove from .pre-commit-config.yaml
-
W605,
diff --git a/manim/mobject/svg/brace.py b/manim/mobject/svg/brace.py
index 1fcfdb686..e030984b9 100644
--- a/manim/mobject/svg/brace.py
+++ b/manim/mobject/svg/brace.py
@@ -67,7 +67,21 @@ class Brace(SVGPathMobject):
background_stroke_color=BLACK,
**kwargs
):
- path_string_template = "m0.01216 0c-0.01152 0-0.01216 6.103e-4 -0.01216 0.01311v0.007762c0.06776 0.122 0.1799 0.1455 0.2307 0.1455h{0}c0.03046 3.899e-4 0.07964 0.00449 0.1246 0.02636 0.0537 0.02695 0.07418 0.05816 0.08648 0.07769 0.001562 0.002538 0.004539 0.002563 0.01098 0.002563 0.006444-2e-8 0.009421-2.47e-5 0.01098-0.002563 0.0123-0.01953 0.03278-0.05074 0.08648-0.07769 0.04491-0.02187 0.09409-0.02597 0.1246-0.02636h{0}c0.05077 0 0.1629-0.02346 0.2307-0.1455v-0.007762c-1.78e-6 -0.0125-6.365e-4 -0.01311-0.01216-0.01311-0.006444-3.919e-8 -0.009348 2.448e-5 -0.01091 0.002563-0.0123 0.01953-0.03278 0.05074-0.08648 0.07769-0.04491 0.02187-0.09416 0.02597-0.1246 0.02636h{1}c-0.04786 0-0.1502 0.02094-0.2185 0.1256-0.06833-0.1046-0.1706-0.1256-0.2185-0.1256h{1}c-0.03046-3.899e-4 -0.07972-0.004491-0.1246-0.02636-0.0537-0.02695-0.07418-0.05816-0.08648-0.07769-0.001562-0.002538-0.004467-0.002563-0.01091-0.002563z"
+ path_string_template = (
+ "m0.01216 0c-0.01152 0-0.01216 6.103e-4 -0.01216 0.01311v0.007762c0.06776 "
+ "0.122 0.1799 0.1455 0.2307 0.1455h{0}c0.03046 3.899e-4 0.07964 0.00449 "
+ "0.1246 0.02636 0.0537 0.02695 0.07418 0.05816 0.08648 0.07769 0.001562 "
+ "0.002538 0.004539 0.002563 0.01098 0.002563 0.006444-2e-8 0.009421-2.47e-"
+ "5 0.01098-0.002563 0.0123-0.01953 0.03278-0.05074 0.08648-0.07769 0.04491"
+ "-0.02187 0.09409-0.02597 0.1246-0.02636h{0}c0.05077 0 0.1629-0.02346 "
+ "0.2307-0.1455v-0.007762c-1.78e-6 -0.0125-6.365e-4 -0.01311-0.01216-0.0131"
+ "1-0.006444-3.919e-8 -0.009348 2.448e-5 -0.01091 0.002563-0.0123 0.01953-"
+ "0.03278 0.05074-0.08648 0.07769-0.04491 0.02187-0.09416 0.02597-0.1246 "
+ "0.02636h{1}c-0.04786 0-0.1502 0.02094-0.2185 0.1256-0.06833-0.1046-0.1706"
+ "-0.1256-0.2185-0.1256h{1}c-0.03046-3.899e-4 -0.07972-0.004491-0.1246-0.02"
+ "636-0.0537-0.02695-0.07418-0.05816-0.08648-0.07769-0.001562-0.002538-"
+ "0.004467-0.002563-0.01091-0.002563z"
+ )
default_min_width = 0.90552
self.buff = buff
@@ -249,9 +263,13 @@ class ArcBrace(Brace):
The :class:`ArcBrace` is smaller for arcs with smaller radii.
.. note::
- The :class:`ArcBrace` is initially a vertical :class:`Brace` defined by the length of the :class:`~.Arc`, but is scaled down to match the start and end angles. An exponential function is then applied after it is shifted based on the radius of the arc.
+ The :class:`ArcBrace` is initially a vertical :class:`Brace` defined by the
+ length of the :class:`~.Arc`, but is scaled down to match the start and end
+ angles. An exponential function is then applied after it is shifted based on
+ the radius of the arc.
- The scaling effect is not applied for arcs with radii smaller than 1 to prevent over-scaling.
+ The scaling effect is not applied for arcs with radii smaller than 1 to prevent
+ over-scaling.
Parameters
----------
diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.py
index 50b81347d..ae7cb196e 100644
--- a/manim/mobject/svg/text_mobject.py
+++ b/manim/mobject/svg/text_mobject.py
@@ -1,7 +1,8 @@
"""Mobjects used for displaying (non-LaTeX) text.
.. note::
- Just as you can use :class:`~.Tex` and :class:`~.MathTex` (from the module :mod:`~.tex_mobject`) to insert LaTeX to your videos, you can use :class:`~.Text` to to add normal text.
+ Just as you can use :class:`~.Tex` and :class:`~.MathTex` (from the module :mod:`~.tex_mobject`)
+ to insert LaTeX to your videos, you can use :class:`~.Text` to to add normal text.
.. important::
@@ -709,7 +710,13 @@ class MarkupText(SVGMobject):
class MarkupElaborateExample(Scene):
def construct(self):
- text = MarkupText('<span foreground="purple">ا</span><span foreground="red">َ</span>ل<span foreground="blue">ْ</span>ع<span foreground="red">َ</span>ر<span foreground="red">َ</span>ب<span foreground="red">ِ</span>ي<span foreground="green">ّ</span><span foreground="red">َ</span>ة<span foreground="blue">ُ</span>')
+ text = MarkupText(
+ '<span foreground="purple">ا</span><span foreground="red">َ</span>'
+ 'ل<span foreground="blue">ْ</span>ع<span foreground="red">َ</span>ر'
+ '<span foreground="red">َ</span>ب<span foreground="red">ِ</span>ي'
+ '<span foreground="green">ّ</span><span foreground="red">َ</span>ة'
+ '<span foreground="blue">ُ</span>'
+ )
self.add(text)
PangoMarkup can also contain XML features such as numeric character
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index 595be0eac..599e45467 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -578,9 +578,13 @@ class VMobject(Mobject):
handles2: Sequence[float],
anchors2: Sequence[float],
) -> "VMobject":
- """Given two sets of anchors and handles, process them to set them as anchors and handles of the VMobject.
+ """Given two sets of anchors and handles, process them to set them as anchors
+ and handles of the VMobject.
- anchors1[i], handles1[i], handles2[i] and anchors2[i] define the i-th bezier curve of the vmobject. There are four hardcoded parameters and this is a problem as it makes the number of points per cubic curve unchangeable from 4. (two anchors and two handles).
+ anchors1[i], handles1[i], handles2[i] and anchors2[i] define the i-th bezier
+ curve of the vmobject. There are four hardcoded parameters and this is a
+ problem as it makes the number of points per cubic curve unchangeable from 4
+ (two anchors and two handles).
Returns
-------
@@ -591,7 +595,11 @@ class VMobject(Mobject):
nppcc = self.n_points_per_cubic_curve # 4
total_len = nppcc * len(anchors1)
self.points = np.zeros((total_len, self.dim))
- # the following will, from the four sets, dispatch them in points such that self.points = [anchors1[0], handles1[0], handles2[0], anchors1[0], anchors1[1], handles1[1], ...]
+ # the following will, from the four sets, dispatch them in points such that
+ # self.points = [
+ # anchors1[0], handles1[0], handles2[0], anchors1[0], anchors1[1],
+ # handles1[1], ...
+ # ]
arrays = [anchors1, handles1, handles2, anchors2]
for index, array in enumerate(arrays):
self.points[index::nppcc] = array
diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.py
index 095f983d7..6955b6b44 100644
--- a/manim/mobject/vector_field.py
+++ b/manim/mobject/vector_field.py
@@ -176,7 +176,11 @@ class VectorField(VGroup):
The amount of steps the whole nudge is divided into. Higher values
give more accurate approximations.
pointwise
- Whether to move the mobject along the vector field. If `True` the vector field takes effect on the center of the given :class:`~.Mobject`. If `False` the vector field takes effect on the points of the individual points of the :class:`~.Mobject`, potentially distorting it.
+ Whether to move the mobject along the vector field. If `True` the
+ vector field takes effect on the center of the given
+ :class:`~.Mobject`. If `False` the vector field takes effect on the
+ points of the individual points of the :class:`~.Mobject`,
+ potentially distorting it.
Returns
-------