Skip to content

Commit 73dec41

Browse files
Removed various return annotations that were stifling type inference (#2408)
* Remove various return annotations that were stifling type inference. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4c48f4f commit 73dec41

File tree

2 files changed

+75
-47
lines changed

2 files changed

+75
-47
lines changed

manim/mobject/mobject.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def generate_points(self):
356356
"""
357357
pass
358358

359-
def add(self, *mobjects: "Mobject") -> "Mobject":
359+
def add(self, *mobjects: "Mobject"):
360360
"""Add mobjects as submobjects.
361361
362362
The mobjects are added to :attr:`submobjects`.
@@ -429,7 +429,7 @@ def __add__(self, mobject):
429429
def __iadd__(self, mobject):
430430
raise NotImplementedError
431431

432-
def add_to_back(self, *mobjects: "Mobject") -> "Mobject":
432+
def add_to_back(self, *mobjects: "Mobject"):
433433
"""Add all passed mobjects to the back of the submobjects.
434434
435435
If :attr:`submobjects` already contains the given mobjects, they just get moved
@@ -485,7 +485,7 @@ def add_to_back(self, *mobjects: "Mobject") -> "Mobject":
485485
self.submobjects = list(dict.fromkeys(mobjects)) + self.submobjects
486486
return self
487487

488-
def remove(self, *mobjects: "Mobject") -> "Mobject":
488+
def remove(self, *mobjects: "Mobject"):
489489
"""Remove :attr:`submobjects`.
490490
491491
The mobjects are removed from :attr:`submobjects`, if they exist.
@@ -518,7 +518,7 @@ def __sub__(self, other):
518518
def __isub__(self, other):
519519
raise NotImplementedError
520520

521-
def set(self, **kwargs) -> "Mobject":
521+
def set(self, **kwargs):
522522
"""Sets attributes.
523523
524524
I.e. ``my_mobject.set(foo=1)`` applies ``my_mobject.foo = 1``.
@@ -770,7 +770,7 @@ def generate_target(self, use_deepcopy=False):
770770

771771
# Updating
772772

773-
def update(self, dt: float = 0, recursive: bool = True) -> "Mobject":
773+
def update(self, dt: float = 0, recursive: bool = True):
774774
"""Apply all updaters.
775775
776776
Does nothing if updating is suspended.
@@ -865,7 +865,7 @@ def add_updater(
865865
update_function: Updater,
866866
index: Optional[int] = None,
867867
call_updater: bool = False,
868-
) -> "Mobject":
868+
):
869869
"""Add an update function to this mobject.
870870
871871
Update functions, or updaters in short, are functions that are applied to the
@@ -935,7 +935,7 @@ def construct(self):
935935
update_function(self, 0)
936936
return self
937937

938-
def remove_updater(self, update_function: Updater) -> "Mobject":
938+
def remove_updater(self, update_function: Updater):
939939
"""Remove an updater.
940940
941941
If the same updater is applied multiple times, every instance gets removed.
@@ -962,7 +962,7 @@ def remove_updater(self, update_function: Updater) -> "Mobject":
962962
self.updaters.remove(update_function)
963963
return self
964964

965-
def clear_updaters(self, recursive: bool = True) -> "Mobject":
965+
def clear_updaters(self, recursive: bool = True):
966966
"""Remove every updater.
967967
968968
Parameters
@@ -988,7 +988,7 @@ def clear_updaters(self, recursive: bool = True) -> "Mobject":
988988
submob.clear_updaters()
989989
return self
990990

991-
def match_updaters(self, mobject: "Mobject") -> "Mobject":
991+
def match_updaters(self, mobject: "Mobject"):
992992
"""Match the updaters of the given mobject.
993993
994994
Parameters
@@ -1018,7 +1018,7 @@ def match_updaters(self, mobject: "Mobject") -> "Mobject":
10181018
self.add_updater(updater)
10191019
return self
10201020

1021-
def suspend_updating(self, recursive: bool = True) -> "Mobject":
1021+
def suspend_updating(self, recursive: bool = True):
10221022
"""Disable updating from updaters and animations.
10231023
10241024
@@ -1045,7 +1045,7 @@ def suspend_updating(self, recursive: bool = True) -> "Mobject":
10451045
submob.suspend_updating(recursive)
10461046
return self
10471047

1048-
def resume_updating(self, recursive: bool = True) -> "Mobject":
1048+
def resume_updating(self, recursive: bool = True):
10491049
"""Enable updating from updaters and animations.
10501050
10511051
Parameters
@@ -1073,7 +1073,7 @@ def resume_updating(self, recursive: bool = True) -> "Mobject":
10731073

10741074
# Transforming operations
10751075

1076-
def apply_to_family(self, func: Callable[["Mobject"], None]) -> "Mobject":
1076+
def apply_to_family(self, func: Callable[["Mobject"], None]):
10771077
"""Apply a function to ``self`` and every submobject with points recursively.
10781078
10791079
Parameters
@@ -1095,7 +1095,7 @@ def apply_to_family(self, func: Callable[["Mobject"], None]) -> "Mobject":
10951095
for mob in self.family_members_with_points():
10961096
func(mob)
10971097

1098-
def shift(self, *vectors: np.ndarray) -> "Mobject":
1098+
def shift(self, *vectors: np.ndarray):
10991099
"""Shift by the given vectors.
11001100
11011101
Parameters
@@ -1121,7 +1121,7 @@ def shift(self, *vectors: np.ndarray) -> "Mobject":
11211121

11221122
return self
11231123

1124-
def scale(self, scale_factor: float, **kwargs) -> "Mobject":
1124+
def scale(self, scale_factor: float, **kwargs):
11251125
r"""Scale the size by a factor.
11261126
11271127
Default behavior is to scale about the center of the mobject.
@@ -1138,8 +1138,8 @@ def scale(self, scale_factor: float, **kwargs) -> "Mobject":
11381138
11391139
Returns
11401140
-------
1141-
Mobject
1142-
The scaled mobject.
1141+
:class:`Mobject`
1142+
``self``
11431143
11441144
Examples
11451145
--------
@@ -2152,7 +2152,7 @@ def arrange_in_grid(
21522152
col_widths: Optional[Iterable[Optional[float]]] = None,
21532153
flow_order: str = "rd",
21542154
**kwargs,
2155-
) -> "Mobject":
2155+
):
21562156
"""Arrange submobjects in a grid.
21572157
21582158
Parameters
@@ -2185,8 +2185,8 @@ def arrange_in_grid(
21852185
21862186
Returns
21872187
-------
2188-
Mobject
2189-
The mobject.
2188+
:class:`Mobject`
2189+
``self``
21902190
21912191
Raises
21922192
------
@@ -2506,11 +2506,16 @@ def align_submobjects(self, mobject):
25062506
mob2.add_n_more_submobjects(max(0, n1 - n2))
25072507
return self
25082508

2509-
def null_point_align(self, mobject: "Mobject") -> "Mobject":
2509+
def null_point_align(self, mobject: "Mobject"):
25102510
"""If a :class:`~.Mobject` with points is being aligned to
25112511
one without, treat both as groups, and push
25122512
the one with points into its own submobjects
25132513
list.
2514+
2515+
Returns
2516+
-------
2517+
:class:`Mobject`
2518+
``self``
25142519
"""
25152520
for m1, m2 in (self, mobject), (mobject, self):
25162521
if m1.has_no_points() and m2.has_points():

0 commit comments

Comments
 (0)