mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Adding spell checker as a pre-commit hook (#1544)
* adding codespell precommit hook * adding codespell config file * fixing typos * tweaking variable names to please codespell
This commit is contained in:
parent
fbee8ad7e0
commit
60a775714e
42 changed files with 105 additions and 97 deletions
1
.codespell_ignorelines
Normal file
1
.codespell_ignorelines
Normal file
|
|
@ -0,0 +1 @@
|
|||
<path id="nd" d="m 464.7,68.6 -1.1,2.8 .8,1.4 -.3,5.1 -.5,1.1 2.7,9.1 1.3,2.5 .7,14 1,2.7 -.4,5.8 2.9,7.4 .3,5.8 -.1,2.1 -29.5,-.4 -46,-2.1 -39.2,-2.9 5.2,-66.7 44.5,3.4 55.3,1.6 z">
|
||||
3
.codespellrc
Normal file
3
.codespellrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[codespell]
|
||||
exclude-file=.codespell_ignorelines
|
||||
check-hidden=True
|
||||
4
.flake8
4
.flake8
|
|
@ -1,12 +1,12 @@
|
|||
[flake8]
|
||||
max-line-length = 88
|
||||
#Black Compatability
|
||||
#Black Compatibility
|
||||
extend-ignore = E203, E266,
|
||||
#Style Changes
|
||||
|
||||
#Temp
|
||||
F841, B007,
|
||||
#I belive these are unfixable
|
||||
#I believe these are unfixable
|
||||
B006
|
||||
#Code Changes - Remove later -remove from .pre-commit-config.yaml
|
||||
|
||||
|
|
|
|||
|
|
@ -29,3 +29,7 @@ repos:
|
|||
rev: 3.9.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.0.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ confidence=
|
|||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once). You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# disable everything first and then re-enable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ Code quality improvements and similar refactors
|
|||
- Added `is_static_wait` attributes to Wait. (<=> if wait is a frozen frame).
|
||||
- Renamed and moved `scene.add_static_frame` to `renderer.freeze_current_frame`.
|
||||
- Now when calling play without animation, it raises `ValueError` instead of just a warning.
|
||||
- Fixed :pr:`874` by modfying `renderer.update_skipping_status`
|
||||
- Fixed :pr:`874` by modifying `renderer.update_skipping_status`
|
||||
- `renderer` starts the animation with `scene.begin_animations` (`scene.compile_animation_data` used to do this)
|
||||
- The run time and the time progression generation is now done in `scene.play_internal` although it'd make more sense that renderer processes it later.
|
||||
- Added a bunch of cool tests thanks to mocks, and thanks to the new syntax `scene.render`
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ Enhancements
|
|||
* `#1364 <https://github.com/ManimCommunity/manim/pull/1364>`__: Added :meth:`~.Mobject.match_points`
|
||||
- Added :func:`~.Mobject.match_points`, which transforms the points, positions and submobjects of a Mobject to match that of the other while keeping style unchanged.
|
||||
|
||||
* `#1363 <https://github.com/ManimCommunity/manim/pull/1363>`__: Change of TeX complier and output file format
|
||||
* `#1363 <https://github.com/ManimCommunity/manim/pull/1363>`__: Change of TeX compiler and output file format
|
||||
|
||||
|
||||
* `#1359 <https://github.com/ManimCommunity/manim/pull/1359>`__: Make FILE a required argument
|
||||
|
|
@ -309,7 +309,7 @@ Documentation-related changes
|
|||
* `#1338 <https://github.com/ManimCommunity/manim/pull/1338>`__: Added documentation guidelines for type hints
|
||||
|
||||
|
||||
* `#1342 <https://github.com/ManimCommunity/manim/pull/1342>`__: Mutliple VauleTracker example for docs
|
||||
* `#1342 <https://github.com/ManimCommunity/manim/pull/1342>`__: Multiple ValueTracker example for docs
|
||||
|
||||
|
||||
* `#1210 <https://github.com/ManimCommunity/manim/pull/1210>`__: Added tutorial chapter on coordinates of an mobject
|
||||
|
|
@ -333,7 +333,7 @@ Documentation-related changes
|
|||
* `#1300 <https://github.com/ManimCommunity/manim/pull/1300>`__: Added typehints for :class:`~.ValueTracker`
|
||||
|
||||
|
||||
* `#1301 <https://github.com/ManimCommunity/manim/pull/1301>`__: Added futher docstrings and typehints to :class:`~.Mobject`
|
||||
* `#1301 <https://github.com/ManimCommunity/manim/pull/1301>`__: Added further docstrings and typehints to :class:`~.Mobject`
|
||||
|
||||
|
||||
* `#1298 <https://github.com/ManimCommunity/manim/pull/1298>`__: Add double backquotes for rst code samples (value_tracker.py)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ Here is the syntax:
|
|||
|
||||
* ``.. manim:: [SCENE_NAME]`` has no indentation and ``SCENE_NAME`` refers to the name of the class below.
|
||||
|
||||
* The flags are followed in the next line (no blank line here!), with the indention level of one tab.
|
||||
* The flags are followed in the next line (no blank line here!), with the indentation level of one tab.
|
||||
|
||||
All possible flags can be found at :mod:`~.manim_directive`.
|
||||
|
||||
|
|
|
|||
|
|
@ -144,13 +144,13 @@ Animations
|
|||
theta_tracker.get_value() * DEGREES, about_point=rotation_center
|
||||
)
|
||||
a = Angle(line1, line_moving, radius=0.5, other_angle=False)
|
||||
te = MathTex(r"\theta").move_to(
|
||||
tex = MathTex(r"\theta").move_to(
|
||||
Angle(
|
||||
line1, line_moving, radius=0.5 + 3 * SMALL_BUFF, other_angle=False
|
||||
).point_from_proportion(0.5)
|
||||
)
|
||||
|
||||
self.add(line1, line_moving, a, te)
|
||||
self.add(line1, line_moving, a, tex)
|
||||
self.wait()
|
||||
|
||||
line_moving.add_updater(
|
||||
|
|
@ -162,7 +162,7 @@ Animations
|
|||
a.add_updater(
|
||||
lambda x: x.become(Angle(line1, line_moving, radius=0.5, other_angle=False))
|
||||
)
|
||||
te.add_updater(
|
||||
tex.add_updater(
|
||||
lambda x: x.move_to(
|
||||
Angle(
|
||||
line1, line_moving, radius=0.5 + 3 * SMALL_BUFF, other_angle=False
|
||||
|
|
@ -172,7 +172,7 @@ Animations
|
|||
|
||||
self.play(theta_tracker.animate.set_value(40))
|
||||
self.play(theta_tracker.animate.increment_value(140))
|
||||
self.play(te.animate.set_color(RED), run_time=0.5)
|
||||
self.play(tex.animate.set_color(RED), run_time=0.5)
|
||||
self.play(theta_tracker.animate.set_value(350))
|
||||
|
||||
.. tip::
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ Enabling plugins through ``manim.cfg``
|
|||
[CLI]
|
||||
plugins = manim_rubikscube
|
||||
|
||||
For specifing multiple plugins, command separated values must be used.
|
||||
For specifying multiple plugins, command separated values must be used.
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ can help in identifying what version of manim files are written for:
|
|||
+--------------+-------------------------+----------------------------+-----------------------------------------+
|
||||
|
||||
If you are a beginner, you should only attempt to run files written for
|
||||
your version. Files written for a different version of manim wil
|
||||
your version. Files written for a different version of manim will
|
||||
generally not work without some modification.
|
||||
|
||||
Identifying the version you are running
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Windows
|
||||
=======
|
||||
|
||||
There are two simple ways to download manim's depedencies, using the popular package
|
||||
There are two simple ways to download manim's dependencies, using the popular package
|
||||
managers `Scoop <https://scoop.sh>`_ and `Chocolatey <https://chocolatey.org/install>`_
|
||||
|
||||
.. _scoop:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ disable_caching = False
|
|||
# --tex_template
|
||||
tex_template =
|
||||
|
||||
# specify the plugins as comma seperated values
|
||||
# specify the plugins as comma separated values
|
||||
# manim will load that plugin if it specified here.
|
||||
plugins =
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ class ManimConfig(MutableMapping):
|
|||
|
||||
manim scene.py -c BLUE
|
||||
|
||||
will set the background color to BLUE, regardless of the conents of
|
||||
will set the background color to BLUE, regardless of the contents of
|
||||
``manim.cfg``.
|
||||
|
||||
Finally, any programmatic changes made within the scene script itself will
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class Animation:
|
|||
self,
|
||||
submobject: Mobject,
|
||||
starting_submobject: Mobject,
|
||||
# target_copy: Mobject, #Todo: fix - signature of interpolate_submobject differes in Transform().
|
||||
# target_copy: Mobject, #Todo: fix - signature of interpolate_submobject differs in Transform().
|
||||
alpha: float,
|
||||
) -> "Animation":
|
||||
# Typically implemented by subclass
|
||||
|
|
@ -386,7 +386,7 @@ class Animation:
|
|||
Returns
|
||||
-------
|
||||
Callable[[float], float]
|
||||
The rate fucntion of the animation.
|
||||
The rate function of the animation.
|
||||
"""
|
||||
return self.rate_func
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ class _Fade(Transform):
|
|||
mobjects
|
||||
The mobjects to be faded.
|
||||
shift
|
||||
The vector by which the mobject shifts while beeing faded.
|
||||
The vector by which the mobject shifts while being faded.
|
||||
target_position
|
||||
The position to/from which the mobject moves while beeing faded in. In case
|
||||
The position to/from which the mobject moves while being faded in. In case
|
||||
another mobject is given as target position, its center is used.
|
||||
scale
|
||||
The factor by which the mobject is scaled initially before beeing rescaling to
|
||||
its original size while beeing faded in.
|
||||
The factor by which the mobject is scaled initially before being rescaling to
|
||||
its original size while being faded in.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -113,13 +113,13 @@ class FadeIn(_Fade):
|
|||
mobjects
|
||||
The mobjects to be faded in.
|
||||
shift
|
||||
The vector by which the mobject shifts while beeing faded in.
|
||||
The vector by which the mobject shifts while being faded in.
|
||||
target_position
|
||||
The position from which the mobject starts while beeing faded in. In case
|
||||
The position from which the mobject starts while being faded in. In case
|
||||
another mobject is given as target position, its center is used.
|
||||
scale
|
||||
The factor by which the mobject is scaled initially before beeing rescaling to
|
||||
its original size while beeing faded in.
|
||||
The factor by which the mobject is scaled initially before being rescaling to
|
||||
its original size while being faded in.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
@ -158,12 +158,12 @@ class FadeOut(_Fade):
|
|||
mobjects
|
||||
The mobjects to be faded out.
|
||||
shift
|
||||
The vector by which the mobject shifts while beeing faded out.
|
||||
The vector by which the mobject shifts while being faded out.
|
||||
target_position
|
||||
The position to which the mobject moves while beeing faded out. In case another
|
||||
The position to which the mobject moves while being faded out. In case another
|
||||
mobject is given as target position, its center is used.
|
||||
scale
|
||||
The factor by which the mobject is scaled while beeing faded out.
|
||||
The factor by which the mobject is scaled while being faded out.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class FocusOn(Transform):
|
|||
|
||||
|
||||
class Indicate(Transform):
|
||||
"""Indicate a Mobject by temporaly resizing and recoloring it.
|
||||
"""Indicate a Mobject by temporarily resizing and recoloring it.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -519,7 +519,7 @@ class ApplyWave(Homotopy):
|
|||
# either rises to one or goes down to zero. Consecutive ripples will have
|
||||
# their amplitudes in oppising directions (first ripple from 0 to 1 to 0,
|
||||
# second from 0 to -1 to 0 and so on). This is how two ripples would be
|
||||
# devided into phases:
|
||||
# divided into phases:
|
||||
|
||||
# ####|#### | |
|
||||
# ## | ## | |
|
||||
|
|
@ -529,8 +529,8 @@ class ApplyWave(Homotopy):
|
|||
# | | ## | ##
|
||||
# | | ####|####
|
||||
|
||||
# However, this looks weired in the middle between two ripples. Therefor the
|
||||
# middle phases do acutally use only one appropriately scaled version of the
|
||||
# However, this looks weird in the middle between two ripples. Therefore the
|
||||
# middle phases do actually use only one appropriately scaled version of the
|
||||
# rate like this:
|
||||
|
||||
# 1 / 4 Time | 2 / 4 Time | 1 / 4 Time
|
||||
|
|
@ -555,7 +555,7 @@ class ApplyWave(Homotopy):
|
|||
# First rising ripple
|
||||
return wave_func(t * phases)
|
||||
elif phase == phases - 1:
|
||||
# last ripple. Rising or falling depening on the number of ripples
|
||||
# last ripple. Rising or falling depending on the number of ripples
|
||||
# The (ripples % 2)-term is used to make this destinction.
|
||||
t -= phase / phases # Time relative to the phase
|
||||
return (1 - wave_func(t * phases)) * (2 * (ripples % 2) - 1)
|
||||
|
|
@ -588,7 +588,7 @@ class Wiggle(Animation):
|
|||
mobject : Mobject
|
||||
The mobject to wiggle.
|
||||
scale_value
|
||||
The factor by which the mobject will be temporarilly scaled.
|
||||
The factor by which the mobject will be temporarily scaled.
|
||||
rotation_angle
|
||||
The wiggle angle.
|
||||
n_wiggles
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ class Camera:
|
|||
return self
|
||||
|
||||
def get_stroke_rgbas(self, vmobject, background=False):
|
||||
"""Get's the RGBA array for the stroke of the passed
|
||||
"""Gets the RGBA array for the stroke of the passed
|
||||
VMobject.
|
||||
|
||||
Parameters
|
||||
|
|
@ -1145,7 +1145,7 @@ class Camera:
|
|||
return centered_space_coords
|
||||
|
||||
|
||||
# NOTE: The methods of the following class have not been mentioned outside of their definitons.
|
||||
# NOTE: The methods of the following class have not been mentioned outside of their definitions.
|
||||
# Their DocStrings are not as detailed as preferred.
|
||||
class BackgroundColoredVMobjectDisplayer:
|
||||
def __init__(self, camera):
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ To save your config please save that file and place it in your current working d
|
|||
|
||||
for key in default:
|
||||
# All the cfg entries for logger need to be validated as styles,
|
||||
# as long as they arent setting the log width or height etc
|
||||
# as long as they aren't setting the log width or height etc
|
||||
if category == "logger" and key not in RICH_NON_STYLE_ENTRIES:
|
||||
desc = "style"
|
||||
style = default[key]
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ def scene(**args):
|
|||
FILE is the name of file in which the SCENE will be inserted.
|
||||
"""
|
||||
if not Path("main.py").exists():
|
||||
raise FileNotFoundError(f"{Path('main.py')} : Not a valid project direcotory.")
|
||||
raise FileNotFoundError(f"{Path('main.py')} : Not a valid project directory.")
|
||||
|
||||
template_name = click.prompt(
|
||||
"template",
|
||||
|
|
|
|||
|
|
@ -2175,7 +2175,7 @@ class Triangle(RegularPolygon):
|
|||
Parameters
|
||||
----------
|
||||
kwargs : Any
|
||||
Additonal arguments to be passed to :class:`RegularPolygon`
|
||||
Additional arguments to be passed to :class:`RegularPolygon`
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ class Matrix(VMobject):
|
|||
h_buff : :class:`float`, optional
|
||||
horizontal buffer, by default 1.3
|
||||
bracket_h_buff : :class:`float`, optional
|
||||
bracket horizonal buffer, by default MED_SMALL_BUFF
|
||||
bracket horizontal buffer, by default MED_SMALL_BUFF
|
||||
bracket_v_buff : :class:`float`, optional
|
||||
bracket veritical buffer, by default MED_SMALL_BUFF
|
||||
bracket vertical buffer, by default MED_SMALL_BUFF
|
||||
add_background_rectangles_to_entries : :class:`bool`, optional
|
||||
`True` if should add backgraound rectangles to entries, by default False
|
||||
include_background_rectangle : :class:`bool`, optional
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ class Mobject(Container):
|
|||
index
|
||||
The index at which the new updater should be added in ``self.updaters``. In case ``index`` is ``None`` the updater will be added at the end.
|
||||
call_updater
|
||||
Wheather or not to call the updater initially. If ``True``, the updater will be called using ``dt=0``.
|
||||
Whether or not to call the updater initially. If ``True``, the updater will be called using ``dt=0``.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -1180,7 +1180,7 @@ class OpenGLMobject:
|
|||
return interpolate(points[i], points[i + 1], subalpha)
|
||||
|
||||
def pfp(self, alpha):
|
||||
"""Abbreviation fo point_from_proportion"""
|
||||
"""Abbreviation for point_from_proportion"""
|
||||
return self.point_from_proportion(alpha)
|
||||
|
||||
def get_pieces(self, n_pieces):
|
||||
|
|
@ -1365,7 +1365,7 @@ class OpenGLMobject:
|
|||
|
||||
def become(self, mobject):
|
||||
"""
|
||||
Edit all data and submobjects to be idential
|
||||
Edit all data and submobjects to be identical
|
||||
to another mobject
|
||||
"""
|
||||
self.align_family(mobject)
|
||||
|
|
@ -1522,7 +1522,7 @@ class OpenGLMobject:
|
|||
return result
|
||||
|
||||
def check_data_alignment(self, array, data_key):
|
||||
# Makes sure that self.data[key] can be brodcast into
|
||||
# Makes sure that self.data[key] can be broadcast into
|
||||
# the given array, meaning its length has to be either 1
|
||||
# or the length of the array
|
||||
d_len = len(self.data[data_key])
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Polyhedron(VGroup):
|
|||
"""An abstract polyhedra class.
|
||||
|
||||
In this implementation, polyhedra are defined with a list of vertex coordinates in space, and a list
|
||||
of faces. This implementataion mirrors that of a standard polyhedral data format (OFF, object file format).
|
||||
of faces. This implementation mirrors that of a standard polyhedral data format (OFF, object file format).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -27,7 +27,7 @@ class Polyhedron(VGroup):
|
|||
A list of coordinates of the corresponding vertices in the polyhedron. Each coordinate will correspond to
|
||||
a vertex. The vertices are indexed with the usual indexing of Python.
|
||||
faces_list
|
||||
A list of faces. Each face is a sublist containing the indicies of the vertices that form the corners of that face.
|
||||
A list of faces. Each face is a sublist containing the indices of the vertices that form the corners of that face.
|
||||
faces_config
|
||||
Configuration for the polygons representing the faces of the polyhedron.
|
||||
graph_config
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ class SVGMobject(metaclass=MetaVMobject):
|
|||
local_style : :class:`Dict`
|
||||
The styling using SVG property names at the point the element is `<use>`d.
|
||||
Not all values are applied; styles defined when the element is specified in
|
||||
the `<def>` tag cannot be overriden here.
|
||||
the `<def>` tag cannot be overridden here.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -493,8 +493,8 @@ class SVGMobject(metaclass=MetaVMobject):
|
|||
# Borrowed/Inspired from:
|
||||
# https://github.com/cjlano/svg/blob/3ea3384457c9780fa7d67837c9c5fd4ebc42cb3b/svg/svg.py#L75
|
||||
|
||||
# match any SVG transformation with its parameter (until final parenthese)
|
||||
# [^)]* == anything but a closing parenthese
|
||||
# match any SVG transformation with its parameter (until final parenthesis)
|
||||
# [^)]* == anything but a closing parenthesis
|
||||
# '|'.join == OR-list of SVG transformations
|
||||
transform_regex = "|".join([x + r"[^)]*\)" for x in transform_names])
|
||||
transforms = re.findall(transform_regex, transform_attr_value)
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class PMobject(Mobject):
|
|||
setattr(self, attr, partial_array)
|
||||
|
||||
|
||||
# TODO, Make the two implementations bellow non-redundant
|
||||
# TODO, Make the two implementations below non-redundant
|
||||
class Mobject1D(PMobject):
|
||||
def __init__(self, density=DEFAULT_POINT_DENSITY_1D, **kwargs):
|
||||
self.density = density
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ class VMobject(Mobject):
|
|||
) -> "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 paramaters 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
|
||||
-------
|
||||
|
|
@ -528,7 +528,7 @@ class VMobject(Mobject):
|
|||
) -> None:
|
||||
"""Add cubic bezier curve to the path.
|
||||
|
||||
NOTE : the first anchor is not a paramater as by default the end of the last sub-path!
|
||||
NOTE : the first anchor is not a parameter as by default the end of the last sub-path!
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -833,8 +833,8 @@ class VMobject(Mobject):
|
|||
|
||||
The algorithm every bezier tuple (anchors and handles) in ``self.points`` (by regrouping each n elements, where
|
||||
n is the number of points per cubic curve)), and evaluate the relation between two anchors with filter_func.
|
||||
NOTE : The filter_func takes an int n as paramater, and will evaluate the relation between points[n] and points[n - 1]. This should probably be changed so
|
||||
the function takes two points as paramters.
|
||||
NOTE : The filter_func takes an int n as parameter, and will evaluate the relation between points[n] and points[n - 1]. This should probably be changed so
|
||||
the function takes two points as parameters.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class VectorField(VGroup):
|
|||
A scalar to the amount the mobject is moved along the vector field.
|
||||
The actual distance is based on the magnitude of the vector field.
|
||||
substeps
|
||||
The amount of steps the whole nudge is devided into. Higher values
|
||||
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. See :meth:`nudge` for details.
|
||||
|
|
@ -291,7 +291,7 @@ class VectorField(VGroup):
|
|||
return self
|
||||
|
||||
def stop_submobject_movement(self) -> "VectorField":
|
||||
"""Stops the continous movement started using :meth:`start_submobject_movement`.
|
||||
"""Stops the continuous movement started using :meth:`start_submobject_movement`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -546,7 +546,7 @@ class StreamLines(VectorField):
|
|||
dt
|
||||
The factor by which the distance an agent moves per step is stretched. Lower values result in a better approximation of the trajectories in the vector field.
|
||||
virtual_time
|
||||
The time the agents get to move in the vector field. Higher values therefor result in longer stream lines. However, this whole time gets simulated upon creation.
|
||||
The time the agents get to move in the vector field. Higher values therefore result in longer stream lines. However, this whole time gets simulated upon creation.
|
||||
max_anchors_per_line
|
||||
The maximum number of anchors per line. Lines with more anchors get reduced in complexity, not in length.
|
||||
padding
|
||||
|
|
@ -703,7 +703,7 @@ class StreamLines(VectorField):
|
|||
Parameters
|
||||
----------
|
||||
lag_ratio
|
||||
The lag ratio ot the animation.
|
||||
The lag ratio of the animation.
|
||||
If undefined, it will be selected so that the total animation length is 1.5 times the run time of each stream line creation.
|
||||
run_time
|
||||
The run time of every single stream line creation. The runtime of the whole animation might be longer due to the `lag_ratio`.
|
||||
|
|
@ -755,7 +755,7 @@ class StreamLines(VectorField):
|
|||
) -> None:
|
||||
"""Animates the stream lines using an updater.
|
||||
|
||||
The stream lines will continously flow
|
||||
The stream lines will continuously flow
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -768,7 +768,7 @@ class StreamLines(VectorField):
|
|||
rate_func
|
||||
The rate function of each stream line flashing
|
||||
line_animation_class
|
||||
The animation class beeing used
|
||||
The animation class being used
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
@ -818,7 +818,7 @@ class StreamLines(VectorField):
|
|||
def end_animation(self) -> AnimationGroup:
|
||||
"""End the stream line animation smoothly.
|
||||
|
||||
Returns an animation resulting in fully displayed stream lines without a noticable cut.
|
||||
Returns an animation resulting in fully displayed stream lines without a noticeable cut.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ void main() {
|
|||
}
|
||||
|
||||
// Control points are projected to the xy plane before drawing, which in turn
|
||||
// gets tranlated to a uv plane. The z-coordinate information will be remembered
|
||||
// gets translated to a uv plane. The z-coordinate information will be remembered
|
||||
// by what's sent out to gl_Position, and by how it affects the lighting and stroke width
|
||||
vec2 flat_controls[3];
|
||||
vec2 flat_prev[3];
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@ class Scene(Container):
|
|||
animation.begin()
|
||||
|
||||
def is_current_animation_frozen_frame(self) -> bool:
|
||||
"""Returns wether the current animation produces a static frame (generally a Wait)."""
|
||||
"""Returns whether the current animation produces a static frame (generally a Wait)."""
|
||||
return (
|
||||
isinstance(self.animations[0], Wait)
|
||||
and len(self.animations) == 1
|
||||
|
|
@ -1092,7 +1092,7 @@ class Scene(Container):
|
|||
)
|
||||
|
||||
# Use the locals of the caller as the local namespace
|
||||
# once embeded, and add a few custom shortcuts.
|
||||
# once embedded, and add a few custom shortcuts.
|
||||
local_ns = inspect.currentframe().f_back.f_locals
|
||||
# local_ns["touch"] = self.interact
|
||||
for method in (
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ def get_smooth_cubic_bezier_handle_points(points):
|
|||
l, u = 2, 1
|
||||
# diag is a representation of the matrix in diagonal form
|
||||
# See https://www.particleincell.com/2012/bezier-splines/
|
||||
# for how to arive at these equations
|
||||
# for how to arrive at these equations
|
||||
diag = np.zeros((l + u + 1, 2 * num_handles))
|
||||
diag[0, 1::2] = -1
|
||||
diag[0, 2::2] = 1
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ for name, value in Colors.__members__.items():
|
|||
constants_names.append(name)
|
||||
|
||||
# Add constants to module exports. Simply adding constants_names would work fine, but
|
||||
# would make it hard for IDEs to understand that colors are exported. Therefor the
|
||||
# would make it hard for IDEs to understand that colors are exported. Therefore the
|
||||
# result of the following print statement is added instead.
|
||||
|
||||
# print(constants_names)
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ def deprecated(
|
|||
Returns
|
||||
-------
|
||||
Any
|
||||
The return value of the given callable when beeing passed the given
|
||||
The return value of the given callable when being passed the given
|
||||
arguments.
|
||||
"""
|
||||
logger.warning(warning_msg())
|
||||
|
|
@ -415,7 +415,7 @@ def deprecated_params(
|
|||
kwargs
|
||||
The keyword argument dictionary to be updated.
|
||||
used
|
||||
The list of depecated parameters used in a call.
|
||||
The list of deprecated parameters used in a call.
|
||||
"""
|
||||
for redirector in redirections:
|
||||
if isinstance(redirector, tuple):
|
||||
|
|
@ -449,7 +449,7 @@ def deprecated_params(
|
|||
Returns
|
||||
-------
|
||||
Any
|
||||
The return value of the given callable when beeing passed the given
|
||||
The return value of the given callable when being passed the given
|
||||
arguments.
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ def get_template_path():
|
|||
|
||||
|
||||
def add_import_statement(file):
|
||||
"""Prepends an import statment in a file
|
||||
"""Prepends an import statement in a file
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ def choose(n, r, use_cache=True):
|
|||
return 0
|
||||
if r == 0:
|
||||
return 1
|
||||
denom = reduce(op.mul, range(1, r + 1), 1)
|
||||
numer = reduce(op.mul, range(n, n - r, -1), 1)
|
||||
return numer // denom
|
||||
denominator = reduce(op.mul, range(1, r + 1), 1)
|
||||
numerator = reduce(op.mul, range(n, n - r, -1), 1)
|
||||
return numerator // denominator
|
||||
|
||||
|
||||
def get_num_args(function):
|
||||
|
|
|
|||
|
|
@ -397,16 +397,16 @@ def find_intersection(p0, v0, p1, v1, threshold=1e-5):
|
|||
m, n = np.shape(p0)
|
||||
assert n in [2, 3]
|
||||
|
||||
numer = np.cross(v1, p1 - p0)
|
||||
denom = np.cross(v1, v0)
|
||||
numerator = np.cross(v1, p1 - p0)
|
||||
denominator = np.cross(v1, v0)
|
||||
if n == 3:
|
||||
d = len(np.shape(numer))
|
||||
new_numer = np.multiply(numer, numer).sum(d - 1)
|
||||
new_denom = np.multiply(denom, numer).sum(d - 1)
|
||||
numer, denom = new_numer, new_denom
|
||||
d = len(np.shape(numerator))
|
||||
new_numerator = np.multiply(numerator, numerator).sum(d - 1)
|
||||
new_denominator = np.multiply(denominator, numerator).sum(d - 1)
|
||||
numerator, denominator = new_numerator, new_denominator
|
||||
|
||||
denom[abs(denom) < threshold] = np.inf # So that ratio goes to 0 there
|
||||
ratio = numer / denom
|
||||
denominator[abs(denominator) < threshold] = np.inf # So that ratio goes to 0 there
|
||||
ratio = numerator / denominator
|
||||
ratio = np.repeat(ratio, n).reshape((m, n))
|
||||
return p0 + ratio * v0
|
||||
|
||||
|
|
@ -488,11 +488,11 @@ def earclip_triangulation(verts, ring_ends):
|
|||
for ring_group in (attached_rings, detached_rings)
|
||||
]
|
||||
|
||||
# Closet point on the atttached rings to an estimated midpoint
|
||||
# Closest point on the attached rings to an estimated midpoint
|
||||
# of the detached rings
|
||||
tmp_j_vert = midpoint(verts[j_range[0]], verts[j_range[len(j_range) // 2]])
|
||||
i = min(i_range, key=lambda i: norm_squared(verts[i] - tmp_j_vert))
|
||||
# Closet point of the detached rings to the aforementioned
|
||||
# Closest point of the detached rings to the aforementioned
|
||||
# point of the attached rings
|
||||
j = min(j_range, key=lambda j: norm_squared(verts[i] - verts[j]))
|
||||
# Recalculate i based on new j
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class TexTemplate:
|
|||
documentclass : :class:`str`
|
||||
The command defining the documentclass, e.g. ``\\documentclass[preview]{standalone}``
|
||||
preamble : :class:`str`
|
||||
The document's preample, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
The document's preamble, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
placeholder_text : :class:`str`
|
||||
Text in the document that will be replaced by the expression to be rendered
|
||||
post_doc_commands : :class:`str`
|
||||
|
|
@ -120,7 +120,7 @@ class TexTemplate:
|
|||
txt : :class:`string`
|
||||
String containing the text to be added, e.g. ``\\usepackage{hyperref}``
|
||||
prepend : Optional[:class:`bool`], optional
|
||||
Whether the text should be added at the beginning of the preample, i.e. right after ``\\documentclass``. Default is to add it at the end of the preample, i.e. right before ``\\begin{document}``
|
||||
Whether the text should be added at the beginning of the preamble, i.e. right after ``\\documentclass``. Default is to add it at the end of the preamble, i.e. right before ``\\begin{document}``
|
||||
"""
|
||||
if prepend:
|
||||
self.preamble = txt + "\n" + self.preamble
|
||||
|
|
@ -193,7 +193,7 @@ class TexTemplate:
|
|||
return begin, end
|
||||
|
||||
def get_texcode_for_expression_in_env(self, expression, environment):
|
||||
r"""Inserts expression into TeX template wrapped in \begin{environemnt} and \end{environment}
|
||||
r"""Inserts expression into TeX template wrapped in \begin{environment} and \end{environment}
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def get_config_from_video(path_to_video):
|
|||
|
||||
def save_control_data_from_video(path_to_video, name):
|
||||
"""Helper used to set up a new test that will compare videos. This will create a new .json file in control_data/videos_data that contains
|
||||
information tested of the video, including its hash. Refer to the wiki for more informations.
|
||||
information tested of the video, including its hash. Refer to the wiki for more information.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -291,15 +291,15 @@ def test_deprecate_nested_class_func_since_and_until(caplog):
|
|||
def test_deprecate_nested_func(caplog):
|
||||
"""Test the deprecation of a nested method (decorator with no arguments)."""
|
||||
b = Top().Bottom()
|
||||
ans = b.normal_func()
|
||||
ans(1)
|
||||
answer = b.normal_func()
|
||||
answer(1)
|
||||
assert len(caplog.record_tuples) == 1
|
||||
msg = _get_caplog_record_msg(caplog)
|
||||
assert (
|
||||
msg
|
||||
== "The method Top.Bottom.normal_func.<locals>.nested_func has been deprecated and may be removed in a later version."
|
||||
)
|
||||
assert ans.__doc__ == f"{doc_admonition}{msg}"
|
||||
assert answer.__doc__ == f"{doc_admonition}{msg}"
|
||||
|
||||
|
||||
def test_deprecate_func_params(caplog):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class SquareToCircle(Scene):
|
|||
|
||||
|
||||
class FunctionLikeTest(Scene):
|
||||
def contruct(self):
|
||||
def construct(self):
|
||||
assert "FunctionLike" in globals()
|
||||
a = FunctionLike()
|
||||
self.play(FadeIn(a))
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ def test_render(using_temp_config, disabling_caching):
|
|||
|
||||
|
||||
def test_skipping_status_with_from_to_and_up_to(using_temp_config, disabling_caching):
|
||||
"""Test if skip_animations is well udpated when -n flag is passed"""
|
||||
"""Test if skip_animations is well updated when -n flag is passed"""
|
||||
config.from_animation_number = 2
|
||||
config.upto_animation_number = 6
|
||||
|
||||
|
|
@ -46,11 +46,11 @@ def test_when_animation_is_cached(using_temp_config):
|
|||
assert scene.renderer.file_writer.is_already_cached(
|
||||
scene.renderer.animations_hashes[0]
|
||||
)
|
||||
# Check that the same partial movie files has been used (with he same hash)
|
||||
# Check that the same partial movie files has been used (with the same hash)
|
||||
assert pmf == scene.renderer.file_writer.partial_movie_files
|
||||
# Check that manim correctly skipped the animation.
|
||||
scene.update_to_time.assert_called_once_with(1)
|
||||
# Check that the ouput video has been generated.
|
||||
# Check that the output video has been generated.
|
||||
assert_file_exists(config["output_file"])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue