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

Code before:
    is_changing_dt = False

    def __init__(
        self,
        anim: Animation | _AnimationBuilder,
        speedinfo: dict[float, float],
        rate_func: Callable[[float], float] | None = None,
        affects_speed_updaters: bool = False,
        **kwargs,
    ) -> None:

        if issubclass(type(anim), AnimationGroup):
            self.anim = type(anim)(
                *map(self.setup, anim.animations),
                group=anim.group,
                run_time=anim.run_time,
                rate_func=anim.rate_func,
                lag_ratio=anim.lag_ratio,
            )
        else:
            self.anim = self.setup(anim)

        if affects_speed_updaters:
            assert (
                ChangeSpeed.is_changing_dt is False
            ), "Only one animation at a time can play that changes speed (dt) for ChangedSpeed updaters"
            ChangeSpeed.is_changing_dt = True
            self.t = 0
        self.affects_speed_updaters = affects_speed_updaters

        self.rate_func = self.anim.rate_func if rate_func is None else rate_func

        # A function where, f(0) = 0, f'(0) = initial speed, f'( f-1(1) ) = final speed
        # Following function obtained when conditions applied to vertical parabola
        self.speed_modifier = (
            lambda x, init_speed, final_speed: (final_speed**2 - init_speed**2)
            * x**2
            / 4
            + init_speed * x
        )

        # f-1(1), returns x for which f(x) = 1 in `speed_modifier` function
        self.f_inv_1 = lambda init_speed, final_speed: 2 / (init_speed + final_speed)

        # if speed factors for the starting node (0) and the final node (1) are
        # not set, set them to 1 and the penultimate factor, respectively
        if 0 not in speedinfo:
            speedinfo[0] = 1
        if 1 not in speedinfo:
            speedinfo[1] = sorted(speedinfo.items())[-1][1]


Review comment (suggestion):
```suggestion
            ), "Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
```

Code after:
    dt = 0
    is_changing_dt = False

    def __init__(
        self,
        anim: Animation | _AnimationBuilder,
        speedinfo: dict[float, float],
        rate_func: Callable[[float], float] | None = None,
        affects_speed_updaters: bool = True,
        **kwargs,
    ) -> None:

        if issubclass(type(anim), AnimationGroup):
            self.anim = type(anim)(
                *map(self.setup, anim.animations),
                group=anim.group,
                run_time=anim.run_time,
                rate_func=anim.rate_func,
                lag_ratio=anim.lag_ratio,
            )
        else:
            self.anim = self.setup(anim)

        if affects_speed_updaters:
            assert (
                ChangeSpeed.is_changing_dt is False
            ), "Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
            ChangeSpeed.is_changing_dt = True
            self.t = 0
        self.affects_speed_updaters = affects_speed_updaters

        self.rate_func = self.anim.rate_func if rate_func is None else rate_func

        # A function where, f(0) = 0, f'(0) = initial speed, f'( f-1(1) ) = final speed
        # Following function obtained when conditions applied to vertical parabola
        self.speed_modifier = lambda x, init_speed, final_speed: (
            (final_speed**2 - init_speed**2) * x**2 / 4 + init_speed * x
        )

        # f-1(1), returns x for which f(x) = 1 in `speed_modifier` function
        self.f_inv_1 = lambda init_speed, final_speed: 2 / (init_speed + final_speed)

        # if speed factors for the starting node (0) and the final node (1) are
        # not set, set them to 1 and the penultimate factor, respectively
        if 0 not in speedinfo:
            speedinfo[0] = 1
        if 1 not in speedinfo:
            speedinfo[1] = sorted(speedinfo.items())[-1][1]

        self.speedinfo = dict(sorted(speedinfo.items()))
        self.functions = []