Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

fix imports, remove __init__.py files, some pep8 linting

Devin Nealafdf907abc07
diff --git a/active_projects/__init__.py b/active_projects/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eola2/__init__.py b/active_projects/eola2/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eop/__init__.py b/active_projects/eop/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eop/chapter0/__init__.py b/active_projects/eop/chapter0/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eop/chapter1/__init__.py b/active_projects/eop/chapter1/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eop/chapter2/__init__.py b/active_projects/eop/chapter2/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/active_projects/eop/reusables/__init__.py b/active_projects/eop/reusables/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/animation/__init__.py b/manimlib/animation/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/animation/composition.py b/manimlib/animation/composition.py
index b5398e5aa..b5818d215 100644
--- a/manimlib/animation/composition.py
+++ b/manimlib/animation/composition.py
@@ -1,4 +1,3 @@
-import itertools as it
import warnings
import numpy as np
@@ -104,8 +103,7 @@ class Succession(Animation):
self.scene_mobjects_at_time = [None for i in range(self.num_anims + 1)]
self.scene_mobjects_at_time[0] = Group()
for i in range(self.num_anims):
- self.scene_mobjects_at_time[i +
- 1] = self.scene_mobjects_at_time[i].copy()
+ self.scene_mobjects_at_time[i + 1] = self.scene_mobjects_at_time[i].copy()
self.animations[i].clean_up(self.scene_mobjects_at_time[i + 1])
self.current_alpha = 0
@@ -154,7 +152,7 @@ class Succession(Animation):
# self.critical_alphas (which is also 1.0)
if not abs(alpha - 1) < 0.001:
warnings.warn(
- "Rounding error not near alpha=1 in Succession.update_mobject," +
+ "Rounding error not near alpha=1 in Succession.update_mobject,"
"instead alpha = %f" % alpha
)
print(self.critical_alphas, alpha)
diff --git a/manimlib/animation/specialized.py b/manimlib/animation/specialized.py
index 57f110e0c..e689412f7 100644
--- a/manimlib/animation/specialized.py
+++ b/manimlib/animation/specialized.py
@@ -1,5 +1,3 @@
-import numpy as np
-
from manimlib.animation.composition import LaggedStart
from manimlib.animation.transform import ApplyMethod
from manimlib.constants import *
diff --git a/manimlib/animation/transform.py b/manimlib/animation/transform.py
index 76c2f27ce..47ec01f56 100644
--- a/manimlib/animation/transform.py
+++ b/manimlib/animation/transform.py
@@ -118,7 +118,7 @@ class ApplyMethod(Transform):
"""
if not inspect.ismethod(method):
raise Exception(
- "Whoops, looks like you accidentally invoked " +
+ "Whoops, looks like you accidentally invoked "
"the method you want to animate"
)
assert(isinstance(method.__self__, Mobject))
diff --git a/manimlib/animation/update.py b/manimlib/animation/update.py
index 45b26f39a..21626ad35 100644
--- a/manimlib/animation/update.py
+++ b/manimlib/animation/update.py
@@ -36,8 +36,6 @@ class MaintainPositionRelativeTo(Animation):
Animation.__init__(self, mobject, **kwargs)
def update_mobject(self, alpha):
- self.mobject.shift(
- self.tracked_mobject.get_critical_point(self.tracked_critical_point) -
- self.mobject.get_critical_point(self.tracked_critical_point) +
- self.diff
- )
+ target = self.tracked_mobject.get_critical_point(self.tracked_critical_point)
+ location = self.mobject.get_critical_point(self.tracked_critical_point)
+ self.mobject.shift(target - location + self.diff)
diff --git a/manimlib/camera/__init__.py b/manimlib/camera/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/camera/camera.py b/manimlib/camera/camera.py
index 519cea649..9e7bcc846 100644
--- a/manimlib/camera/camera.py
+++ b/manimlib/camera/camera.py
@@ -1,4 +1,3 @@
-
from functools import reduce
import itertools as it
import operator as op
@@ -15,7 +14,6 @@ from manimlib.mobject.mobject import Mobject
from manimlib.mobject.types.point_cloud_mobject import PMobject
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.utils.color import color_to_int_rgba
-from manimlib.utils.color import rgb_to_hex
from manimlib.utils.config_ops import digest_config
from manimlib.utils.images import get_full_raster_image_path
from manimlib.utils.iterables import batch_by_property
diff --git a/manimlib/camera/mapping_camera.py b/manimlib/camera/mapping_camera.py
index d7347d0c3..d4a0ea154 100644
--- a/manimlib/camera/mapping_camera.py
+++ b/manimlib/camera/mapping_camera.py
@@ -35,6 +35,7 @@ class MappingCamera(Camera):
excluded_mobjects=None,
)
+
# Note: This allows layering of multiple cameras onto the same portion of the pixel array,
# the later cameras overwriting the former
#
@@ -42,7 +43,6 @@ class MappingCamera(Camera):
# CameraPlusOverlay class)
# TODO, the classes below should likely be deleted
-
class OldMultiCamera(Camera):
def __init__(self, *cameras_with_start_positions, **kwargs):
self.shifted_cameras = [
diff --git a/manimlib/camera/moving_camera.py b/manimlib/camera/moving_camera.py
index 4bf0fe647..c54a1e6b2 100644
--- a/manimlib/camera/moving_camera.py
+++ b/manimlib/camera/moving_camera.py
@@ -5,7 +5,6 @@ from manimlib.constants import ORIGIN
from manimlib.constants import WHITE
from manimlib.mobject.frame import ScreenRectangle
from manimlib.mobject.types.vectorized_mobject import VGroup
-from manimlib.mobject.types.vectorized_mobject import VectorizedPoint
from manimlib.utils.config_ops import digest_config
diff --git a/manimlib/camera/three_d_camera.py b/manimlib/camera/three_d_camera.py
index cf6a1be28..32e30d230 100644
--- a/manimlib/camera/three_d_camera.py
+++ b/manimlib/camera/three_d_camera.py
@@ -7,7 +7,6 @@ from manimlib.mobject.three_d_utils import get_3d_vmob_end_corner_unit_normal
from manimlib.mobject.three_d_utils import get_3d_vmob_start_corner
from manimlib.mobject.three_d_utils import get_3d_vmob_start_corner_unit_normal
from manimlib.mobject.types.point_cloud_mobject import Point
-from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.mobject.value_tracker import ValueTracker
from manimlib.utils.color import get_shaded_rgb
from manimlib.utils.simple_functions import clip_in_place
diff --git a/manimlib/container/__init__.py b/manimlib/container/__init__.py
deleted file mode 100644
index 8b1378917..000000000
--- a/manimlib/container/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/manimlib/continual_animation/__init__.py b/manimlib/continual_animation/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/continual_animation/continual_animation.py b/manimlib/continual_animation/continual_animation.py
index e75f81b61..88f632a50 100644
--- a/manimlib/continual_animation/continual_animation.py
+++ b/manimlib/continual_animation/continual_animation.py
@@ -42,8 +42,7 @@ class ContinualAnimation(object):
dt *= float(self.external_time) / self.start_up_time
elif self.external_time > self.end_time - self.wind_down_time:
dt *= np.clip(
- float(self.end_time - self.external_time) /
- self.wind_down_time,
+ float(self.end_time - self.external_time) / self.wind_down_time,
0, 1
)
self.internal_time += dt
diff --git a/manimlib/continual_animation/from_animation.py b/manimlib/continual_animation/from_animation.py
index b49263dcb..2d478d25f 100644
--- a/manimlib/continual_animation/from_animation.py
+++ b/manimlib/continual_animation/from_animation.py
@@ -1,5 +1,3 @@
-
-
from manimlib.continual_animation.continual_animation import ContinualAnimation
diff --git a/manimlib/continual_animation/numbers.py b/manimlib/continual_animation/numbers.py
index 50faa18e9..f8763ec6e 100644
--- a/manimlib/continual_animation/numbers.py
+++ b/manimlib/continual_animation/numbers.py
@@ -1,5 +1,3 @@
-
-
from manimlib.animation.numbers import ChangingDecimal
from manimlib.continual_animation.from_animation import NormalAnimationAsContinualAnimation
diff --git a/manimlib/continual_animation/update.py b/manimlib/continual_animation/update.py
index 7e97ff96a..c4c551953 100644
--- a/manimlib/continual_animation/update.py
+++ b/manimlib/continual_animation/update.py
@@ -1,5 +1,3 @@
-
-
from manimlib.animation.update import MaintainPositionRelativeTo
from manimlib.continual_animation.continual_animation import ContinualAnimation
from manimlib.mobject.value_tracker import ValueTracker
diff --git a/manimlib/extract_scene.py b/manimlib/extract_scene.py
index 8fc0d2819..85f11a28b 100644
--- a/manimlib/extract_scene.py
+++ b/manimlib/extract_scene.py
@@ -1,7 +1,7 @@
-import importlib
import inspect
import itertools as it
import os
+import platform
import subprocess as sp
import sys
import traceback
@@ -13,7 +13,6 @@ import manimlib.constants
def handle_scene(scene, **config):
- import platform
if config["quiet"]:
curr_stdout = sys.stdout
sys.stdout = open(os.devnull, "w")
diff --git a/manimlib/for_3b1b_videos/common_scenes.py b/manimlib/for_3b1b_videos/common_scenes.py
index 6b7dcfaa0..be041d297 100644
--- a/manimlib/for_3b1b_videos/common_scenes.py
+++ b/manimlib/for_3b1b_videos/common_scenes.py
@@ -1,7 +1,5 @@
import random
-import string
-from manimlib.animation.animation import Animation
from manimlib.animation.composition import LaggedStart
from manimlib.animation.creation import DrawBorderThenFill
from manimlib.animation.creation import FadeIn
diff --git a/manimlib/for_3b1b_videos/pi_class.py b/manimlib/for_3b1b_videos/pi_class.py
index fb453af05..77a813e18 100644
--- a/manimlib/for_3b1b_videos/pi_class.py
+++ b/manimlib/for_3b1b_videos/pi_class.py
@@ -1,15 +1,12 @@
-import warnings
-
-import numpy as np
-
from manimlib.constants import *
from manimlib.for_3b1b_videos.pi_creature import PiCreature
from manimlib.mobject.types.vectorized_mobject import VGroup
+
class PiCreatureClass(VGroup):
CONFIG = {
- "width" : 3,
- "height" : 2
+ "width": 3,
+ "height": 2
}
def __init__(self, **kwargs):
@@ -17,7 +14,5 @@ class PiCreatureClass(VGroup):
for i in range(self.width):
for j in range(self.height):
pi = PiCreature().scale(0.3)
- pi.move_to(i*DOWN + j* RIGHT)
+ pi.move_to(i * DOWN + j * RIGHT)
self.add(pi)
-
-
diff --git a/manimlib/for_3b1b_videos/pi_creature.py b/manimlib/for_3b1b_videos/pi_creature.py
index 088960ab3..97052a1fa 100644
--- a/manimlib/for_3b1b_videos/pi_creature.py
+++ b/manimlib/for_3b1b_videos/pi_creature.py
@@ -12,8 +12,6 @@ from manimlib.mobject.svg.tex_mobject import TextMobject
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.utils.config_ops import digest_config
-from manimlib.utils.rate_functions import squish_rate_func
-from manimlib.utils.rate_functions import there_and_back
from manimlib.utils.space_ops import get_norm
pi_creature_dir_maybe = os.path.join(MEDIA_DIR, "designs", "PiCreature")
@@ -60,7 +58,7 @@ class PiCreature(SVGMobject):
"%s_%s.svg" % (self.file_name_prefix, mode)
)
SVGMobject.__init__(self, file_name=svg_file, **kwargs)
- except:
+ except Exception:
warnings.warn("No %s design with mode %s" %
(self.file_name_prefix, mode))
svg_file = os.path.join(
diff --git a/manimlib/for_3b1b_videos/pi_creature_animations.py b/manimlib/for_3b1b_videos/pi_creature_animations.py
index 6f02ca9b2..6fa76f625 100644
--- a/manimlib/for_3b1b_videos/pi_creature_animations.py
+++ b/manimlib/for_3b1b_videos/pi_creature_animations.py
@@ -100,44 +100,23 @@ class RemovePiCreatureBubble(AnimationGroup):
surrounding_scene.add(self.pi_creature)
-
class FlashThroughClass(Animation):
CONFIG = {
- "highlight_color" : GREEN,
+ "highlight_color": GREEN,
}
- def __init__(self, mobject, mode = "linear", **kwargs):
-
+ def __init__(self, mobject, mode="linear", **kwargs):
if not isinstance(mobject, PiCreatureClass):
raise Exception("FlashThroughClass mobject must be a PiCreatureClass")
digest_config(self, kwargs)
self.indices = list(range(mobject.height * mobject.width))
-
if mode == "random":
np.random.shuffle(self.indices)
-
Animation.__init__(self, mobject, **kwargs)
-
def update_mobject(self, alpha):
index = int(np.floor(alpha * self.mobject.height * self.mobject.width))
-
for pi in self.mobject:
pi.set_color(BLUE_E)
if index < self.mobject.height * self.mobject.width:
self.mobject[self.indices[index]].set_color(self.highlight_color)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/manimlib/for_3b1b_videos/pi_creature_scene.py b/manimlib/for_3b1b_videos/pi_creature_scene.py
index 1b70bb9f1..a30dcd20a 100644
--- a/manimlib/for_3b1b_videos/pi_creature_scene.py
+++ b/manimlib/for_3b1b_videos/pi_creature_scene.py
@@ -1,8 +1,6 @@
import itertools as it
import random
-import numpy as np
-
from manimlib.animation.transform import ApplyMethod
from manimlib.animation.transform import ReplacementTransform
from manimlib.animation.transform import Transform
diff --git a/manimlib/mobject/__init__.py b/manimlib/mobject/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py
index e707f5d76..49a820389 100644
--- a/manimlib/mobject/mobject.py
+++ b/manimlib/mobject/mobject.py
@@ -19,7 +19,6 @@ from manimlib.utils.iterables import remove_list_redundancies
from manimlib.utils.paths import straight_path
from manimlib.utils.simple_functions import get_num_args
from manimlib.utils.space_ops import angle_of_vector
-from manimlib.utils.space_ops import complex_to_R3
from manimlib.utils.space_ops import get_norm
from manimlib.utils.space_ops import rotation_matrix
@@ -102,7 +101,7 @@ class Mobject(Container):
def get_image(self, camera=None):
if camera is None:
- from camera.camera import Camera
+ from manimlib.camera.camera import Camera
camera = Camera()
camera.capture_mobject(self)
return camera.get_image()
diff --git a/manimlib/mobject/svg/__init__.py b/manimlib/mobject/svg/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/mobject/svg/drawings.py b/manimlib/mobject/svg/drawings.py
index 62e11d8d6..1e22f1078 100644
--- a/manimlib/mobject/svg/drawings.py
+++ b/manimlib/mobject/svg/drawings.py
@@ -544,7 +544,7 @@ class Car(SVGMobject):
self.set_stroke(color=WHITE, width=0)
self.set_fill(self.color, opacity=1)
- from for_3b1b_videos.pi_creature import Randolph
+ from manimlib.for_3b1b_videos.pi_creature import Randolph
randy = Randolph(mode="happy")
randy.set_height(0.6 * self.get_height())
randy.stretch(0.8, 0)
diff --git a/manimlib/mobject/types/__init__.py b/manimlib/mobject/types/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py
index efefd65bc..bb9c45112 100644
--- a/manimlib/mobject/types/vectorized_mobject.py
+++ b/manimlib/mobject/types/vectorized_mobject.py
@@ -520,8 +520,8 @@ class VMobject(Mobject):
# Each element of index_allocation is like a bucket,
# and its value tells you the appropriate index of
# the smaller curve.
- index_allocation = (np.arange(curr + n - 1) *
- num_curves) // (curr + n - 1)
+ index_allocation = (
+ np.arange(curr + n - 1) * num_curves) // (curr + n - 1)
for index in range(num_curves):
curr_bezier_points = self.points[3 * index:3 * index + 4]
num_inter_curves = sum(index_allocation == index)
diff --git a/manimlib/once_useful_constructs/arithmetic.py b/manimlib/once_useful_constructs/arithmetic.py
index dac1f428d..3720d798f 100644
--- a/manimlib/once_useful_constructs/arithmetic.py
+++ b/manimlib/once_useful_constructs/arithmetic.py
@@ -66,9 +66,7 @@ class RearrangeEquation(Scene):
"""
num_start_terms = len(start_terms)
all_mobs = np.array(
- TexMobject(start_terms).split() +
- TexMobject(end_terms).split()
- )
+ TexMobject(start_terms).split() + TexMobject(end_terms).split())
all_terms = np.array(start_terms + end_terms)
for term in set(all_terms):
matches = all_terms == term
diff --git a/manimlib/once_useful_constructs/combinatorics.py b/manimlib/once_useful_constructs/combinatorics.py
index 2e56f667a..e4fdab29b 100644
--- a/manimlib/once_useful_constructs/combinatorics.py
+++ b/manimlib/once_useful_constructs/combinatorics.py
@@ -7,10 +7,11 @@ from manimlib.utils.simple_functions import choose
DEFAULT_COUNT_NUM_OFFSET = (FRAME_X_RADIUS - 1, FRAME_Y_RADIUS - 1, 0)
-DEFAULT_COUNT_RUN_TIME = 5.0
+DEFAULT_COUNT_RUN_TIME = 5.0
+
class CountingScene(Scene):
- def count(self, items, item_type = "mobject", *args, **kwargs):
+ def count(self, items, item_type="mobject", *args, **kwargs):
if item_type == "mobject":
self.count_mobjects(items, *args, **kwargs)
elif item_type == "region":
@@ -20,18 +21,19 @@ class CountingScene(Scene):
return self
def count_mobjects(
- self, mobjects, mode = "highlight",
- color = "red",
- display_numbers = True,
- num_offset = DEFAULT_COUNT_NUM_OFFSET,
- run_time = DEFAULT_COUNT_RUN_TIME):
+ self, mobjects, mode="highlight",
+ color="red",
+ display_numbers=True,
+ num_offset=DEFAULT_COUNT_NUM_OFFSET,
+ run_time=DEFAULT_COUNT_RUN_TIME,
+ ):
"""
Note, leaves final number mobject as "number" attribute
mode can be "highlight", "show_creation" or "show", otherwise
a warning is given and nothing is animating during the count
"""
- if len(mobjects) > 50: #TODO
+ if len(mobjects) > 50: # TODO
raise Exception("I don't know if you should be counting \
too many mobjects...")
if len(mobjects) == 0:
@@ -52,7 +54,7 @@ class CountingScene(Scene):
self.wait(frame_time)
mob.set_color(original_color)
if mode == "show_creation":
- self.play(ShowCreation(mob, run_time = frame_time))
+ self.play(ShowCreation(mob, run_time=frame_time))
if mode == "show":
self.add(mob)
self.wait(frame_time)
@@ -63,10 +65,10 @@ class CountingScene(Scene):
self.number = num_mob
return self
- def count_regions(self, regions,
- mode = "one_at_a_time",
- num_offset = DEFAULT_COUNT_NUM_OFFSET,
- run_time = DEFAULT_COUNT_RUN_TIME,
+ def count_regions(self, regions,
+ mode="one_at_a_time",
+ num_offset=DEFAULT_COUNT_NUM_OFFSET,
+ run_time=DEFAULT_COUNT_RUN_TIME,
**unused_kwargsn):
if mode not in ["one_at_a_time", "show_all"]:
raise Warning("Unknown mode")
@@ -84,34 +86,34 @@ class CountingScene(Scene):
self.number = num_mob
return self
-def combinationMobject(n,k):
- return Integer(choose(n,k))
+
+def combinationMobject(n, k):
+ return Integer(choose(n, k))
class GeneralizedPascalsTriangle(VMobject):
CONFIG = {
- "nrows" : 7,
- "height" : FRAME_HEIGHT - 1,
- "width" : 1.5*FRAME_X_RADIUS,
- "portion_to_fill" : 0.7,
- "submob_class" : combinationMobject,
- }
+ "nrows": 7,
+ "height": FRAME_HEIGHT - 1,
+ "width": 1.5 * FRAME_X_RADIUS,
+ "portion_to_fill": 0.7,
+ "submob_class": combinationMobject,
+ }
+
def generate_points(self):
self.cell_height = float(self.height) / self.nrows
self.cell_width = float(self.width) / self.nrows
- self.bottom_left = (self.cell_width * self.nrows / 2.0)*LEFT + \
- (self.cell_height * self.nrows / 2.0)*DOWN
- num_to_num_mob = {}
+ self.bottom_left = (self.cell_width * self.nrows / 2.0) * LEFT + \
+ (self.cell_height * self.nrows / 2.0) * DOWN
self.coords_to_mobs = {}
self.coords = [
- (n, k)
- for n in range(self.nrows)
- for k in range(n+1)
+ (n, k)
+ for n in range(self.nrows)
+ for k in range(n + 1)
]
for n, k in self.coords:
- num = choose(n, k)
center = self.coords_to_center(n, k)
- num_mob = self.submob_class(n,k) #TexMobject(str(num))
+ num_mob = self.submob_class(n, k) # TexMobject(str(num))
scale_factor = min(
1,
self.portion_to_fill * self.cell_height / num_mob.get_height(),
@@ -122,20 +124,20 @@ class GeneralizedPascalsTriangle(VMobject):
self.coords_to_mobs[n] = {}
self.coords_to_mobs[n][k] = num_mob
self.add(*[
- self.coords_to_mobs[n][k]
+ self.coords_to_mobs[n][k]
for n, k in self.coords
])
return self
def coords_to_center(self, n, k):
- x_offset = self.cell_width * (k+self.nrows/2.0 - n/2.0)
+ x_offset = self.cell_width * (k + self.nrows / 2.0 - n / 2.0)
y_offset = self.cell_height * (self.nrows - n)
- return self.bottom_left + x_offset*RIGHT + y_offset*UP
+ return self.bottom_left + x_offset * RIGHT + y_offset * UP
def generate_n_choose_k_mobs(self):
self.coords_to_n_choose_k = {}
for n, k in self.coords:
- nck_mob = TexMobject(r"{%d \choose %d}"%(n, k))
+ nck_mob = TexMobject(r"{%d \choose %d}" % (n, k))
scale_factor = min(
1,
self.portion_to_fill * self.cell_height / nck_mob.get_height(),
@@ -162,8 +164,8 @@ class GeneralizedPascalsTriangle(VMobject):
zero = TexMobject("0")
self.sea_of_zeros = []
for n in range(self.nrows):
- for a in range((self.nrows - n)/2 + 1):
- for k in (n + a + 1, -a -1):
+ for a in range((self.nrows - n) / 2 + 1):
+ for k in (n + a + 1, -a - 1):
self.coords.append((n, k))
mob = zero.copy()
mob.shift(self.coords_to_center(n, k))
@@ -175,20 +177,12 @@ class GeneralizedPascalsTriangle(VMobject):
n = self.nrows - 1
lowest_row = VGroup(*[
self.coords_to_mobs[n][k]
- for k in range(n+1)
+ for k in range(n + 1)
])
return lowest_row
class PascalsTriangle(GeneralizedPascalsTriangle):
CONFIG = {
- "submob_class" : combinationMobject,
+ "submob_class": combinationMobject,
}
-
-
-
-
-
-
-
-
diff --git a/manimlib/once_useful_constructs/fractals.py b/manimlib/once_useful_constructs/fractals.py
index 8b71fad84..3e6276425 100644
--- a/manimlib/once_useful_constructs/fractals.py
+++ b/manimlib/once_useful_constructs/fractals.py
@@ -296,8 +296,8 @@ class JaggedCurvePiece(VMobject):
if self.get_num_anchor_points() == 0:
self.points = np.zeros((1, 3))
anchors = self.get_anchors()
- indices = np.linspace(0, len(anchors) - 1, n +
- len(anchors)).astype('int')
+ indices = np.linspace(0, len(anchors) - 1, n + len(anchors)) \
+ .astype('int')
self.set_points_as_corners(anchors[indices])
diff --git a/manimlib/once_useful_constructs/graph_theory.py b/manimlib/once_useful_constructs/graph_theory.py
index 775b2286e..890a13aba 100644
--- a/manimlib/once_useful_constructs/graph_theory.py
+++ b/manimlib/once_useful_constructs/graph_theory.py
@@ -13,13 +13,13 @@ from manimlib.utils.space_ops import center_of_mass
class Graph():
def __init__(self):
# List of points in R^3
- vertices = []
+ # vertices = []
# List of pairs of indices of vertices
- edges = []
+ # edges = []
# List of tuples of indices of vertices. The last should
# be a cycle whose interior is the entire graph, and when
# regions are computed its complement will be taken.
- region_cycles = []
+ # region_cycles = []
self.construct()
@@ -275,7 +275,7 @@ class DiscreteGraphScene(Scene):
])
def trace_cycle(self, cycle=None, color="yellow", run_time=2.0):
- if cycle == None:
+ if cycle is None:
cycle = self.graph.region_cycles[0]
time_per_edge = run_time / len(cycle)
next_in_cycle = it.cycle(cycle)
@@ -385,8 +385,7 @@ class DiscreteGraphScene(Scene):
Dot(point).set_color("green")
for point in self.dual_points
]
- self.dual_vertices[-1] = Circle().scale(FRAME_X_RADIUS +
- FRAME_Y_RADIUS)
+ self.dual_vertices[-1] = Circle().scale(FRAME_X_RADIUS + FRAME_Y_RADIUS)
self.dual_points[-1] = point_at_infinity
self.dual_edges = []
diff --git a/manimlib/once_useful_constructs/light.py b/manimlib/once_useful_constructs/light.py
index 7294f0976..56f2b6e87 100644
--- a/manimlib/once_useful_constructs/light.py
+++ b/manimlib/once_useful_constructs/light.py
@@ -242,7 +242,7 @@ class Spotlight(VMobject):
projected_screen_points = list(map(self.project, screen_points))
viewing_angles = np.array(list(map(self.viewing_angle_of_point,
- projected_screen_points)))
+ projected_screen_points)))
lower_angle = upper_angle = 0
if len(viewing_angles) != 0:
@@ -420,7 +420,7 @@ class LightSource(VMobject):
else:
# Note: See below
index = self.submobjects.index(self.spotlight)
- camera_mob = self.spotlight.camera_mob
+ # camera_mob = self.spotlight.camera_mob
self.remove(self.spotlight)
self.spotlight = Spotlight(
source_point=VectorizedPoint(location=self.get_source_point()),
diff --git a/manimlib/once_useful_constructs/region.py b/manimlib/once_useful_constructs/region.py
index f2f8ae87d..ab76ac10d 100644
--- a/manimlib/once_useful_constructs/region.py
+++ b/manimlib/once_useful_constructs/region.py
@@ -99,7 +99,7 @@ def plane_partition(*lines, **kwargs):
def plane_partition_from_points(*points, **kwargs):
"""
Returns list of regions cut out by the complete graph
- with points from the argument as vertices.
+ with points from the argument as vertices.
Each point comes in the form (x, y)
"""
diff --git a/manimlib/scene/__init__.py b/manimlib/scene/__init__.py
deleted file mode 100644
index 8b1378917..000000000
--- a/manimlib/scene/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/manimlib/scene/graph_scene.py b/manimlib/scene/graph_scene.py
index 5bdf93c15..0f23ad8b3 100644
--- a/manimlib/scene/graph_scene.py
+++ b/manimlib/scene/graph_scene.py
@@ -440,7 +440,7 @@ class GraphScene(Scene):
triangle.move_to(self.coords_to_point(x_val, 0), UP)
triangle.set_fill(color, 1)
triangle.set_stroke(width=0)
- if label == None:
+ if label is None:
T_label = TexMobject(self.variable_point_label, fill_color=color)
else:
T_label = TexMobject(label, fill_color=color)
diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py
index 53b611b77..6c72b545c 100644
--- a/manimlib/scene/scene.py
+++ b/manimlib/scene/scene.py
@@ -2,7 +2,6 @@ from time import sleep
import _thread as thread
import datetime
import inspect
-import itertools as it
import os
import random
import shutil
@@ -26,6 +25,7 @@ from manimlib.utils.output_directory_getters import add_extension_if_not_present
from manimlib.utils.output_directory_getters import get_image_output_directory
from manimlib.utils.output_directory_getters import get_movie_output_directory
+
class Scene(Container):
CONFIG = {
"camera_class": Camera,
@@ -274,8 +274,9 @@ class Scene(Container):
for list_name in "mobjects", "foreground_mobjects":
self.restructure_mobjects(mobjects, list_name, False)
- self.continual_animations = [ca for ca in self.continual_animations if ca not in continual_animations and
- ca.mobject not in to_remove]
+ self.continual_animations = [
+ ca for ca in self.continual_animations if ca not in
+ continual_animations and ca.mobject not in to_remove]
return self
def restructure_mobjects(
@@ -676,7 +677,7 @@ class Scene(Container):
anims = []
anims.append(Write(eq))
for mobject in self.mobjects:
- anims.append(ApplyMethod(mobject.shift,2*UP))
+ anims.append(ApplyMethod(mobject.shift, 2 * UP))
self.play(*anims)
diff --git a/manimlib/utils/__init__.py b/manimlib/utils/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/__init__.py b/old_projects/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/basel/__init__.py b/old_projects/basel/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/brachistochrone/__init__.py b/old_projects/brachistochrone/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/eoc/__init__.py b/old_projects/eoc/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/eola/__init__.py b/old_projects/eola/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/hilbert/__init__.py b/old_projects/hilbert/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/nn/__init__.py b/old_projects/nn/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/old_projects/triangle_of_power/__init__.py b/old_projects/triangle_of_power/__init__.py
deleted file mode 100644
index e69de29bb..000000000