From 60a775714e8eb2142904d0bb021a8796e839e927 Mon Sep 17 00:00:00 2001 From: Skaft <42238012+Skaft@users.noreply.github.com> Date: Fri, 21 May 2021 12:13:31 +0200 Subject: [PATCH] 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 --- .codespell_ignorelines | 1 + .codespellrc | 3 +++ .flake8 | 4 ++-- .pre-commit-config.yaml | 4 ++++ .pylintrc | 2 +- docs/source/changelog/0.5.0-changelog.rst | 2 +- docs/source/changelog/0.6.0-changelog.rst | 6 ++--- docs/source/contributing/documentation.rst | 2 +- docs/source/examples.rst | 8 +++---- docs/source/installation/plugins.rst | 2 +- docs/source/installation/troubleshooting.rst | 2 +- docs/source/installation/win.rst | 2 +- manim/_config/default.cfg | 2 +- manim/_config/utils.py | 2 +- manim/animation/animation.py | 4 ++-- manim/animation/fading.py | 22 +++++++++---------- manim/animation/indication.py | 12 +++++----- manim/camera/camera.py | 4 ++-- manim/cli/cfg/group.py | 2 +- manim/cli/new/group.py | 2 +- manim/mobject/geometry.py | 2 +- manim/mobject/matrix.py | 4 ++-- manim/mobject/mobject.py | 2 +- manim/mobject/opengl_mobject.py | 6 ++--- manim/mobject/polyhedra.py | 4 ++-- manim/mobject/svg/svg_mobject.py | 6 ++--- manim/mobject/types/point_cloud_mobject.py | 2 +- manim/mobject/types/vectorized_mobject.py | 8 +++---- manim/mobject/vector_field.py | 14 ++++++------ .../shaders/quadratic_bezier_stroke/geom.glsl | 2 +- manim/scene/scene.py | 4 ++-- manim/utils/bezier.py | 2 +- manim/utils/color.py | 2 +- manim/utils/deprecation.py | 6 ++--- manim/utils/file_ops.py | 2 +- manim/utils/simple_functions.py | 6 ++--- manim/utils/space_ops.py | 20 ++++++++--------- manim/utils/tex.py | 6 ++--- tests/helpers/video_utils.py | 2 +- tests/test_deprecation.py | 6 ++--- tests/test_plugins/simple_scenes.py | 2 +- .../test_cairo_renderer.py | 6 ++--- 42 files changed, 105 insertions(+), 97 deletions(-) create mode 100644 .codespell_ignorelines create mode 100644 .codespellrc diff --git a/.codespell_ignorelines b/.codespell_ignorelines new file mode 100644 index 0000000000..ae00dfdf8e --- /dev/null +++ b/.codespell_ignorelines @@ -0,0 +1 @@ + diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000000..922b46a211 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +exclude-file=.codespell_ignorelines +check-hidden=True diff --git a/.flake8 b/.flake8 index 9a2a2335ce..3d7150aba3 100644 --- a/.flake8 +++ b/.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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d21f5e8873..433b419318 100644 --- a/.pre-commit-config.yaml +++ b/.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 diff --git a/.pylintrc b/.pylintrc index 5aeef51691..1753d5b517 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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 diff --git a/docs/source/changelog/0.5.0-changelog.rst b/docs/source/changelog/0.5.0-changelog.rst index e413d2633b..6ab0e76332 100644 --- a/docs/source/changelog/0.5.0-changelog.rst +++ b/docs/source/changelog/0.5.0-changelog.rst @@ -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` diff --git a/docs/source/changelog/0.6.0-changelog.rst b/docs/source/changelog/0.6.0-changelog.rst index 02254b8d38..4c3d85cc6b 100644 --- a/docs/source/changelog/0.6.0-changelog.rst +++ b/docs/source/changelog/0.6.0-changelog.rst @@ -177,7 +177,7 @@ Enhancements * `#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 `__: Change of TeX complier and output file format +* `#1363 `__: Change of TeX compiler and output file format * `#1359 `__: Make FILE a required argument @@ -309,7 +309,7 @@ Documentation-related changes * `#1338 `__: Added documentation guidelines for type hints -* `#1342 `__: Mutliple VauleTracker example for docs +* `#1342 `__: Multiple ValueTracker example for docs * `#1210 `__: Added tutorial chapter on coordinates of an mobject @@ -333,7 +333,7 @@ Documentation-related changes * `#1300 `__: Added typehints for :class:`~.ValueTracker` -* `#1301 `__: Added futher docstrings and typehints to :class:`~.Mobject` +* `#1301 `__: Added further docstrings and typehints to :class:`~.Mobject` * `#1298 `__: Add double backquotes for rst code samples (value_tracker.py) diff --git a/docs/source/contributing/documentation.rst b/docs/source/contributing/documentation.rst index 6322002c15..a254566ef0 100644 --- a/docs/source/contributing/documentation.rst +++ b/docs/source/contributing/documentation.rst @@ -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`. diff --git a/docs/source/examples.rst b/docs/source/examples.rst index ea198961c1..ca8e2d7500 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -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:: diff --git a/docs/source/installation/plugins.rst b/docs/source/installation/plugins.rst index 81286d18cd..e1e037f55c 100644 --- a/docs/source/installation/plugins.rst +++ b/docs/source/installation/plugins.rst @@ -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 diff --git a/docs/source/installation/troubleshooting.rst b/docs/source/installation/troubleshooting.rst index 9469f35af7..a116d83ede 100644 --- a/docs/source/installation/troubleshooting.rst +++ b/docs/source/installation/troubleshooting.rst @@ -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 diff --git a/docs/source/installation/win.rst b/docs/source/installation/win.rst index b03d37812c..359b186e82 100644 --- a/docs/source/installation/win.rst +++ b/docs/source/installation/win.rst @@ -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 `_ and `Chocolatey `_ .. _scoop: diff --git a/manim/_config/default.cfg b/manim/_config/default.cfg index ace1f0d101..29e0d79286 100644 --- a/manim/_config/default.cfg +++ b/manim/_config/default.cfg @@ -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 = diff --git a/manim/_config/utils.py b/manim/_config/utils.py index f861a2429d..d0e8f82ccc 100644 --- a/manim/_config/utils.py +++ b/manim/_config/utils.py @@ -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 diff --git a/manim/animation/animation.py b/manim/animation/animation.py index b345782691..d58320edb8 100644 --- a/manim/animation/animation.py +++ b/manim/animation/animation.py @@ -294,7 +294,7 @@ def interpolate_submobject( 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 @@ def get_rate_func( Returns ------- Callable[[float], float] - The rate fucntion of the animation. + The rate function of the animation. """ return self.rate_func diff --git a/manim/animation/fading.py b/manim/animation/fading.py index 572a3e9637..2a4b99f158 100644 --- a/manim/animation/fading.py +++ b/manim/animation/fading.py @@ -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 -------- diff --git a/manim/animation/indication.py b/manim/animation/indication.py index 395824b368..e6b9eabc5d 100644 --- a/manim/animation/indication.py +++ b/manim/animation/indication.py @@ -130,7 +130,7 @@ def create_starting_mobject(self) -> "Dot": 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 @@ def wave(t): # 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 @@ def wave(t): # | | ## | ## # | | ####|#### - # 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 @@ def wave(t): # 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 diff --git a/manim/camera/camera.py b/manim/camera/camera.py index acd256605e..8cb1ca987f 100644 --- a/manim/camera/camera.py +++ b/manim/camera/camera.py @@ -741,7 +741,7 @@ def apply_stroke(self, ctx, vmobject, background=False): 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 @@ def get_coords_of_all_pixels(self): 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): diff --git a/manim/cli/cfg/group.py b/manim/cli/cfg/group.py index 9595872352..0d7756c4e3 100644 --- a/manim/cli/cfg/group.py +++ b/manim/cli/cfg/group.py @@ -160,7 +160,7 @@ def write(level: str = None, openfile: bool = False) -> None: 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] diff --git a/manim/cli/new/group.py b/manim/cli/new/group.py index a09d369fe7..6cf13dc5be 100644 --- a/manim/cli/new/group.py +++ b/manim/cli/new/group.py @@ -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", diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py index 946fe4aa22..52d2e2db67 100644 --- a/manim/mobject/geometry.py +++ b/manim/mobject/geometry.py @@ -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 -------- diff --git a/manim/mobject/matrix.py b/manim/mobject/matrix.py index f7b67dc35f..f6b32567a7 100644 --- a/manim/mobject/matrix.py +++ b/manim/mobject/matrix.py @@ -90,9 +90,9 @@ def __init__( 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 diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py index 923da5ea4c..8a232070b7 100644 --- a/manim/mobject/mobject.py +++ b/manim/mobject/mobject.py @@ -883,7 +883,7 @@ def add_updater( 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 ------- diff --git a/manim/mobject/opengl_mobject.py b/manim/mobject/opengl_mobject.py index a4003bdd45..604db4390e 100644 --- a/manim/mobject/opengl_mobject.py +++ b/manim/mobject/opengl_mobject.py @@ -1180,7 +1180,7 @@ def point_from_proportion(self, alpha): 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 @@ def pointwise_become_partial(self, mobject, a, b): 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 @@ def get_shader_wrapper_list(self): 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]) diff --git a/manim/mobject/polyhedra.py b/manim/mobject/polyhedra.py index 8379644857..ee323c4784 100644 --- a/manim/mobject/polyhedra.py +++ b/manim/mobject/polyhedra.py @@ -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 diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py index ec5f0a467b..a475552e80 100644 --- a/manim/mobject/svg/svg_mobject.py +++ b/manim/mobject/svg/svg_mobject.py @@ -275,7 +275,7 @@ def use_to_mobjects( local_style : :class:`Dict` The styling using SVG property names at the point the element is ``d. Not all values are applied; styles defined when the element is specified in - the `` tag cannot be overriden here. + the `` tag cannot be overridden here. Returns ------- @@ -493,8 +493,8 @@ def handle_transforms(self, element, mobject): # 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) diff --git a/manim/mobject/types/point_cloud_mobject.py b/manim/mobject/types/point_cloud_mobject.py index 743a1dc86d..f9b61778c2 100644 --- a/manim/mobject/types/point_cloud_mobject.py +++ b/manim/mobject/types/point_cloud_mobject.py @@ -173,7 +173,7 @@ def pointwise_become_partial(self, mobject, a, b): 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 diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py index 1263b71e4c..e9b19094ed 100644 --- a/manim/mobject/types/vectorized_mobject.py +++ b/manim/mobject/types/vectorized_mobject.py @@ -485,7 +485,7 @@ def set_anchors_and_handles( ) -> "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 @@ def add_cubic_bezier_curve_to( ) -> 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 @@ def _gen_subpaths_from_points( 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 ---------- diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.py index ed93955de5..9458cece70 100644 --- a/manim/mobject/vector_field.py +++ b/manim/mobject/vector_field.py @@ -226,7 +226,7 @@ def nudge_submobjects( 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 @@ def start_submobject_movement( 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 @@ def create( 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 @@ def start_animation( ) -> 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 @@ def start_animation( 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 @@ def updater(mob, dt): 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 ------- diff --git a/manim/renderer/shaders/quadratic_bezier_stroke/geom.glsl b/manim/renderer/shaders/quadratic_bezier_stroke/geom.glsl index 9eda1a6e50..30c11fa3bd 100644 --- a/manim/renderer/shaders/quadratic_bezier_stroke/geom.glsl +++ b/manim/renderer/shaders/quadratic_bezier_stroke/geom.glsl @@ -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]; diff --git a/manim/scene/scene.py b/manim/scene/scene.py index 8f9caabafa..676192c54a 100644 --- a/manim/scene/scene.py +++ b/manim/scene/scene.py @@ -925,7 +925,7 @@ def begin_animations(self) -> None: 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 @@ def embed(self): ) # 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 ( diff --git a/manim/utils/bezier.py b/manim/utils/bezier.py index a1e8b0a024..0697fec7a3 100644 --- a/manim/utils/bezier.py +++ b/manim/utils/bezier.py @@ -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 diff --git a/manim/utils/color.py b/manim/utils/color.py index 188144d9a7..4d96425ba7 100644 --- a/manim/utils/color.py +++ b/manim/utils/color.py @@ -272,7 +272,7 @@ def named_lines_group(length, colors, names, text_colors, align_to_block): 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) diff --git a/manim/utils/deprecation.py b/manim/utils/deprecation.py index 6d61395152..82f84797a3 100644 --- a/manim/utils/deprecation.py +++ b/manim/utils/deprecation.py @@ -202,7 +202,7 @@ def deprecate(func: Callable, *args, **kwargs): 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 redirect_params(kwargs: dict, used: List[str]): 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 deprecate_params(func, *args, **kwargs): 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. """ diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.py index 30b8898643..b980fd6070 100644 --- a/manim/utils/file_ops.py +++ b/manim/utils/file_ops.py @@ -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 ---------- diff --git a/manim/utils/simple_functions.py b/manim/utils/simple_functions.py index 108a053618..b96dbfe9e6 100644 --- a/manim/utils/simple_functions.py +++ b/manim/utils/simple_functions.py @@ -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): diff --git a/manim/utils/space_ops.py b/manim/utils/space_ops.py index b85c57e84f..a892207aa8 100644 --- a/manim/utils/space_ops.py +++ b/manim/utils/space_ops.py @@ -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 diff --git a/manim/utils/tex.py b/manim/utils/tex.py index e0114e7a9e..fa7ffe5c31 100644 --- a/manim/utils/tex.py +++ b/manim/utils/tex.py @@ -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 @@ def add_to_preamble(self, txt, prepend=False): 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 @@ def _texcode_for_environment(self, environment): 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 ---------- diff --git a/tests/helpers/video_utils.py b/tests/helpers/video_utils.py index 1e115e45d5..9776a217eb 100644 --- a/tests/helpers/video_utils.py +++ b/tests/helpers/video_utils.py @@ -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 ---------- diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py index fd698b44ba..21895a8195 100644 --- a/tests/test_deprecation.py +++ b/tests/test_deprecation.py @@ -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..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): diff --git a/tests/test_plugins/simple_scenes.py b/tests/test_plugins/simple_scenes.py index 41edca5f1b..2933687a5f 100644 --- a/tests/test_plugins/simple_scenes.py +++ b/tests/test_plugins/simple_scenes.py @@ -9,7 +9,7 @@ def construct(self): class FunctionLikeTest(Scene): - def contruct(self): + def construct(self): assert "FunctionLike" in globals() a = FunctionLike() self.play(FadeIn(a)) diff --git a/tests/test_scene_rendering/test_cairo_renderer.py b/tests/test_scene_rendering/test_cairo_renderer.py index 2516719e7d..9e098cdf17 100644 --- a/tests/test_scene_rendering/test_cairo_renderer.py +++ b/tests/test_scene_rendering/test_cairo_renderer.py @@ -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"])