Skip to content

Commit 662777b

Browse files
leotrsPgBielAathish04naveen521kk
authored
Docs (#347)
* add some module docstrings * add some breathing room in the generated autosummaries * edit template so it generates cleaner output * document add and remove * document new conf.py option * updates from code review Co-authored-by: Pg Biel <[email protected]> Co-authored-by: Aathish Sivasubrahmanian <[email protected]> Co-authored-by: Naveen M K <[email protected]>
1 parent b3c079d commit 662777b

File tree

14 files changed

+86
-23
lines changed

14 files changed

+86
-23
lines changed

docs/source/_static/custom.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
td {
2+
padding: 0px 10px 0px 10px;
3+
}

docs/source/_templates/autosummary/class.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
.. autoclass:: {{ objname }}
66

77
{% block methods %}
8-
{% if methods %}
8+
{%- if methods %}
99
.. rubric:: {{ _('Methods') }}
1010

1111
.. autosummary::
1212
:nosignatures:
1313
:toctree: .
1414
{% for item in methods if item != '__init__' and item not in inherited_members %}
15-
~{{ name }}.{{ item }}
15+
~{{ name }}.{{ item }}
1616
{%- endfor %}
17-
{% endif %}
18-
{% endblock %}
17+
{%- endif %}
18+
{%- endblock %}
1919

2020
{% block attributes %}
21-
{% if attributes %}
21+
{%- if attributes %}
2222
.. rubric:: {{ _('Attributes') }}
2323

2424
.. autosummary::
25-
{% for item in attributes %}
26-
~{{ name }}.{{ item }}
27-
{%- endfor %}
28-
{% endif %}
25+
{% for item in attributes %}
26+
~{{ name }}.{{ item }}
27+
{%- endfor %}
28+
{%- endif %}
2929
{% endblock %}

docs/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@
6666
# Register the theme as an extension to generate a sitemap.xml
6767
extensions.append("guzzle_sphinx_theme")
6868

69-
7069
# Add any paths that contain custom static files (such as style sheets) here,
7170
# relative to this directory. They are copied after the builtin static files,
7271
# so a file named "default.css" will overwrite the builtin "default.css".
7372
html_static_path = ['_static']
73+
74+
# This specifies any additional css files that will override the theme's
75+
html_css_files = ['custom.css']

manim/animation/animation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Animate mobjects."""
12
from copy import deepcopy
23

34
import numpy as np

manim/animation/composition.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Tools for displaying multiple animations at once."""
12
import numpy as np
23

34
from ..animation.animation import Animation

manim/animation/creation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Animate the display or removal of a mobject from a scene."""
12
from ..animation.animation import Animation
23
from ..animation.composition import Succession
34
from ..mobject.types.vectorized_mobject import VMobject
@@ -131,7 +132,7 @@ def update_submobject_list(self, index):
131132

132133
class AddTextLetterByLetter(ShowIncreasingSubsets):
133134
"""
134-
Add a Text Object letter by letter on the scene. Use time_per_char to change frequency of appearance of the letters.
135+
Add a Text Object letter by letter on the scene. Use time_per_char to change frequency of appearance of the letters.
135136
"""
136137

137138
CONFIG = {

manim/animation/fading.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Fading in and out of view."""
12
from ..animation.animation import Animation
23
from ..animation.animation import DEFAULT_ANIMATION_LAG_RATIO
34
from ..animation.transform import Transform

manim/camera/camera.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"A Camera converts the mobjects contained in a Scene into an array of pixels"
12
from functools import reduce
23
import itertools as it
34
import operator as op

manim/mobject/geometry.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
"""
2-
geometry.py
3-
-----------
4-
5-
Classes implementing geometric objects, mostly derived from MObject.
6-
7-
"""
1+
"""Mobjects that are simple geometric shapes."""
82
import warnings
93
import numpy as np
104
import math

manim/mobject/mobject.py

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
MObject: Base classes for all mathematical objects.
3-
"""
1+
"""Base classes for objects that can be displayed."""
42
from functools import reduce
53
import copy
64
import itertools as it
@@ -30,8 +28,13 @@
3028

3129

3230
class Mobject(Container):
33-
"""
34-
Mathematical Object
31+
"""Mathematical Object: base class for objects that can be displayed on screen.
32+
33+
Attributes
34+
----------
35+
submobjects : :class:`list`
36+
The contained objects.
37+
3538
"""
3639

3740
CONFIG = {
@@ -69,6 +72,37 @@ def generate_points(self):
6972
pass
7073

7174
def add(self, *mobjects):
75+
"""Add mobjects as submobjects.
76+
77+
The mobjects are added to self.submobjects.
78+
79+
Parameters
80+
----------
81+
mobjects : List[:class:`Mobject`]
82+
The mobjects to add.
83+
84+
Returns
85+
-------
86+
:class:`Mobject`
87+
:code:`self`
88+
89+
Raises
90+
------
91+
:class:`ValueError`
92+
When a mobject tries to add itself.
93+
94+
Notes
95+
-----
96+
A mobject cannot contain itself, and it cannot contain a submobject
97+
more than once. If the parent mobject is displayed, the newly-added
98+
submobjects will also be displayed (i.e. they are automatically added
99+
to the parent Scene).
100+
101+
See Also
102+
--------
103+
:meth:`~Mobject.remove`
104+
105+
"""
72106
if self in mobjects:
73107
raise ValueError("Mobject cannot contain self")
74108
self.submobjects = list_update(self.submobjects, mobjects)
@@ -80,6 +114,25 @@ def add_to_back(self, *mobjects):
80114
return self
81115

82116
def remove(self, *mobjects):
117+
"""Remove submobjects.
118+
119+
The mobjects are removed from self.submobjects, if they exist.
120+
121+
Parameters
122+
----------
123+
mobjects : List[:class:`Mobject`]
124+
The mobjects to remove.
125+
126+
Returns
127+
-------
128+
:class:`Mobject`
129+
:code:`self`
130+
131+
See Also
132+
--------
133+
:meth:`~Mobject.add`
134+
135+
"""
83136
for mobject in mobjects:
84137
if mobject in self.submobjects:
85138
self.submobjects.remove(mobject)
@@ -1097,6 +1150,8 @@ def set_z_index_by_z_coordinate(self):
10971150

10981151

10991152
class Group(Mobject):
1153+
"""Groups together multiple Mobjects."""
1154+
11001155
def __init__(self, *mobjects, **kwargs):
11011156
if not all([isinstance(m, Mobject) for m in mobjects]):
11021157
raise Exception("All submobjects must be of type Mobject")

0 commit comments

Comments
 (0)