Repository: ManimCommunity/manim
File: manim/animation/speedmodifier.py (Python)

Code before:
        return prepare_animation(anim)

    def get_scaled_total_time(self) -> float:
        """The time taken by the animation under the assumption that the ``run_time`` is 1."""
        prevnode = 0
        init_speed = self.speedinfo[0]
        total_time = 0
        for node, final_speed in list(self.speedinfo.items())[1:]:
            dur = node - prevnode
            total_time += dur * self.f_inv_1(init_speed, final_speed)
            prevnode = node
            init_speed = final_speed
        return total_time

    @classmethod
    def add_updater(
        self,
        mobject: Mobject,
        update_function: Updater,
        index: int | None = None,
        call_updater: bool = False,
    ):
        """This static method can be used to apply speed change to updaters.
        This updater will follow speed and rate function of any ``ChangeSpeed``
        animation that is playing with ``affects_speed_updaters=True``.
        """
        parameters = get_parameters(update_function)
        if "dt" in parameters:
            mobject.add_updater(
                lambda mob, dt: update_function(
                    mob, ChangeSpeed.dt if ChangeSpeed.is_changing_dt else dt
                ),
                index=index,
                call_updater=call_updater,
            )
        else:
            mobject.add_updater(update_function, index=index, call_updater=call_updater)

    def interpolate(self, alpha: float) -> None:
        self.anim.interpolate(alpha)

    def update_mobjects(self, dt: float) -> None:
        self.anim.update_mobjects(dt)

    def finish(self) -> None:
        ChangeSpeed.is_changing_dt = False
        self.anim.finish()

    def begin(self) -> None:
        self.anim.begin()


Review comment (suggestion):
A final bit of nitpicking to improve this docstring.

```suggestion
        """This static method can be used to apply speed change to updaters.

        This updater will follow speed and rate function of any :class:`.ChangeSpeed`
        animation that is playing with ``affects_speed_updaters=True``. By default,
        updater functions added via the usual :meth:`.Mobject.add_updater` method
        do not respect the change of animation speed.

        Parameters
        ----------
        mobject
            The mobject to which the updater should be attached.
        update_function
            The function that is called whenever a new frame is rendered.
        index
            The position in the list of the mobject's updaters at which the
            function should be inserted.
        call_updater
            If ``True``, calls the update function when attaching it to the
            mobject.

        See also
        --------
        :class:`.ChangeSpeed`
        :meth:`.Mobject.add_updater`
        """
```

Code after:
                lambda self, alpha: self.rate_func(alpha), anim
            )
        return prepare_animation(anim)

    def get_scaled_total_time(self) -> float:
        """The time taken by the animation under the assumption that the ``run_time`` is 1."""
        prevnode = 0
        init_speed = self.speedinfo[0]
        total_time = 0
        for node, final_speed in list(self.speedinfo.items())[1:]:
            dur = node - prevnode
            total_time += dur * self.f_inv_1(init_speed, final_speed)
            prevnode = node
            init_speed = final_speed
        return total_time

    @classmethod
    def add_updater(
        self,
        mobject: Mobject,
        update_function: Updater,
        index: int | None = None,
        call_updater: bool = False,
    ):
        """This static method can be used to apply speed change to updaters.

        This updater will follow speed and rate function of any :class:`.ChangeSpeed`
        animation that is playing with ``affects_speed_updaters=True``. By default,
        updater functions added via the usual :meth:`.Mobject.add_updater` method
        do not respect the change of animation speed.

        Parameters
        ----------
        mobject
            The mobject to which the updater should be attached.
        update_function
            The function that is called whenever a new frame is rendered.
        index
            The position in the list of the mobject's updaters at which the
            function should be inserted.
        call_updater
            If ``True``, calls the update function when attaching it to the
            mobject.

        See also
        --------
        :class:`.ChangeSpeed`
        :meth:`.Mobject.add_updater`
        """
        parameters = get_parameters(update_function)
        if "dt" in parameters: