Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fixed all current docbuild warnings (#1424)

Benjamin Hackl7f17ea6d24ad
diff --git a/docs/source/contributing/development.rst b/docs/source/contributing/development.rst
index e689da710..076c75398 100644
--- a/docs/source/contributing/development.rst
+++ b/docs/source/contributing/development.rst
@@ -194,22 +194,23 @@ Our pipeline consists of a series of different tests that ensure
that manim still works as intended and that the code you added
sticks to our coding conventions.
-- *Code style*: We use the code style imposed
+- **Code style**: We use the code style imposed
by `Black <https://black.readthedocs.io/en/stable/>`_, `isort <https://pycqa.github.io/isort/>`_
and `flake8 <https://flake8.pycqa.org/en/latest/>`_. The GitHub pipeline
makes sure that the (Python) files changed in your pull request
also adhere to this code style. If this step of the pipeline fails,
- fix your code formating automatically by running ``black <file or directory>`` and ``isort <file or directory>``.
- To fix code style problems, run ``flake8 <file or directory>`` for a style report, and then fix the problems manually that were detected by ``flake8 ``.
+ fix your code formatting automatically by running ``black <file or directory>`` and ``isort <file or directory>``.
+ To fix code style problems, run ``flake8 <file or directory>`` for a style report, and then fix the problems
+ manually that were detected by ``flake8``.
-- *Tests*: The pipeline runs manim's test suite on different operating systems
+- **Tests**: The pipeline runs manim's test suite on different operating systems
(the latest versions of Ubuntu, MacOS, and Windows) for different versions of Python.
The test suite consists of two different kinds of tests: integration tests
and doctests. You can run them locally by executing ``poetry run pytest``
and ``poetry run pytest --doctest-modules manim``, respectively, from the
root directory of your cloned fork.
-- *Documentation*: We also build a version of the documentation corresponding
+- **Documentation**: We also build a version of the documentation corresponding
to your pull request. Make sure not to introduce any Sphinx errors, and have
a look at the built HTML files to see whether the formatting of the documentation
you added looks as you intended. You can build the documentation locally
@@ -249,8 +250,8 @@ Further useful guidelines
You can find examples for the ``docs`` in several places:
-the :doc:`Example Gallery<examples>`, :doc:`Tutorials<tutorials>`,
-and :doc:`Reference Classes<reference>`.
+the :doc:`Example Gallery <../examples>`, :doc:`Tutorials <../tutorials>`,
+and :doc:`Reference Classes <../reference>`.
In case you are contributing, please have a look at this flowchart:
diff --git a/docs/source/contributing/documentation.rst b/docs/source/contributing/documentation.rst
index e66623000..42d22d66e 100644
--- a/docs/source/contributing/documentation.rst
+++ b/docs/source/contributing/documentation.rst
@@ -336,6 +336,7 @@ When adding type hints to manim, there are some guidelines that should be follow
def set_points_as_corners(self, points: Sequence[float]) -> "VMobject":
"""Given an array of points, set them as corner of the Vmobject."""
+
* ``**kwargs`` has no typehint
* Mobjects have the typehint "Mobject", e.g.
@@ -345,12 +346,14 @@ When adding type hints to manim, there are some guidelines that should be follow
def match_color(self, mobject: "Mobject"):
"""Match the color with the color of another :class:`~.Mobject`."""
return self.set_color(mobject.get_color())
+
* Colors have the typehint ``Color``, e.g.
.. code:: py
def set_color(self, color: Color = YELLOW_C, family: bool = True):
"""Condition is function which takes in one arguments, (x, y, z)."""
+
* As ``float`` and ``Union[int, float]`` are the same, use only ``float``
* For numpy arrays use the typehint ``np.ndarray``
@@ -361,6 +364,7 @@ When adding type hints to manim, there are some guidelines that should be follow
def height(self, value) -> None:
self.scale_to_fit_height(value)
+
* Parameters that are None by default should get the type hint ``Optional``
.. code:: py
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index e8bf4b336..f768842fe 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -26,6 +26,7 @@ Installing dependencies
.. toctree::
+ installation/versions
installation/win
installation/mac
installation/linux
diff --git a/docs/source/installation/versions.rst b/docs/source/installation/versions.rst
index 6a7e38591..77f8e54ef 100644
--- a/docs/source/installation/versions.rst
+++ b/docs/source/installation/versions.rst
@@ -22,7 +22,7 @@ In early 2021, Grant merged the shaders branch back into master, making it the d
The old version is still available as the branch ``cairo-backend``.
The three versions of Manim
-****************************
+***************************
There are currently three main versions of manim. They are as follows:
@@ -41,7 +41,7 @@ If you would like to use a version with full OpenGL support or render recent 3Bl
If you would like to render old 3Blue1Brown projects (2019 and before), you should use ManimCairo.
Notes on installation, documentation, and use
-********************************************
+*********************************************
If you are a beginner, it is very important that you only use the documentation for your desired version.
Trying to install or learn manim using documentation or guides made for different versions will likely fail and only lead to more confusion.
As many tutorials and guides on the internet are outdated, we do not recommend you follow them.
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index 0e054af2a..da2d4cbe5 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -62,7 +62,7 @@ class Mobject(Container):
.. seealso::
- :class:`~.VMobject`
+ :class:`~.VMobject`
"""
@@ -1027,21 +1027,23 @@ class Mobject(Container):
return self
def scale(self, scale_factor: float, **kwargs) -> "Mobject":
- """Scale the size by a factor.
+ r"""Scale the size by a factor.
Default behavior is to scale about the center of the mobject.
Parameters
----------
scale_factor
- The scaling factor. Values 0 < |`scale_factor`| < 1 will shrink the mobject, 1 < |`scale_factor`| will increase it's size. A `scale_factor`<0 resuls in additionally flipping by 180°.
- kwargs :
+ The scaling factor :math:`\alpha`. If :math:`0 < |\alpha| < 1`, the mobject
+ will shrink, and for :math:`|\alpha| > 1` it will grow. Furthermore, if :math:`\alpha < 0`,
+ the mobject is also flipped.
+ kwargs
Additional keyword arguments passed to :meth:`apply_points_function_about_point`.
Returns
-------
- :class:`Mobject`
- ``self``
+ Mobject
+ The scaled mobject.
See also
--------
@@ -2363,7 +2365,7 @@ class Mobject(Container):
class Group(Mobject):
- """Groups together multiple :class:`~.Mobject`s."""
+ """Groups together multiple :class:`Mobjects <.Mobject>`."""
def __init__(self, *mobjects, **kwargs):
Mobject.__init__(self, **kwargs)
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index 1a77e1c66..cb478131a 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -540,7 +540,7 @@ class Line3D(Cylinder):
def set_start_and_end_attrs(self, start, end, **kwargs):
"""Sets the start and end points of the line.
- If either ``start`` or ``end`` are :class:`~.Mobject`s, this gives their centers.
+ If either ``start`` or ``end`` are :class:`Mobjects <.Mobject>`, this gives their centers.
"""
rough_start = self.pointify(start)
rough_end = self.pointify(end)
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index a0f8f8f45..7bc691c52 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -550,8 +550,9 @@ class VMobject(Mobject):
def add_line_to(self, point: np.ndarray) -> "VMobject":
"""Add a straight line from the last point of VMobject to the given point.
- Parameters :
- ------------
+ Parameters
+ ----------
+
point : np.ndarray
end of the straight line.
"""
@@ -725,10 +726,10 @@ class VMobject(Mobject):
handles closer to their anchors, apply the function then push them out
again.
- Paramters
- ---------
- factor : float
- factor used for scaling.
+ Parameters
+ ----------
+ factor
+ The factor used for scaling.
Returns
-------
@@ -1153,10 +1154,10 @@ class VMobject(Mobject):
def insert_n_curves(self, n: int) -> "VMobject":
"""Inserts n curves to the bezier curves of the vmobject.
- Paramters
- ---------
- n : int
- Number of curves to insert
+ Parameters
+ ----------
+ n
+ Number of curves to insert.
Returns
-------
@@ -1315,12 +1316,13 @@ class VMobject(Mobject):
"""Returns the subcurve of the VMobject between the interval [a, b].
The curve is a VMobject itself.
- Parameters :
- ------------
- a : float
- lower-bound
- b : float
- upper-boud
+ Parameters
+ ----------
+
+ a
+ The lower bound.
+ b
+ The upper bound.
Returns
-------