Repository: ManimCommunity/manim
File: manim/mobject/types/vectorized_mobject.py (Python)

Code before:
        typing.Iterable[typing.Tuple[typing.Callable[[float], np.ndarray], float]]
            The functions and lengths of the curves.
        """

        num_curves = self.get_num_curves()

        for n in range(num_curves):
            yield self.get_nth_curve_function_with_length(n, **kwargs)

    def point_from_proportion(self, alpha: float) -> np.ndarray:
        """Get the bezier curve evaluated at a position P,
        where P is the point corresponding to the proportion defined by the given alpha.

        Parameters
        ----------
        alpha : float
            Proportion.

        Returns
        -------
        np.ndarray
            Point evaluated.
        """

        if alpha >= 1:
            return self.points[-1]

        target_length = alpha * self.get_arc_length()
        current_length = 0

        for curve, length in self.get_curve_functions_with_lengths():
            if current_length + length >= target_length:
                if length != 0:
                    residue = (target_length - current_length) / length
                else:
                    residue = 0

                return curve(residue)

            current_length += length

    def get_anchors_and_handles(self) -> typing.Iterable[np.ndarray]:
        """Returns anchors1, handles1, handles2, anchors2,
        where (anchors1[i], handles1[i], handles2[i], anchors2[i])
        will be four points defining a cubic bezier curve
        for any i in range(0, len(anchors1))

        Returns
        -------
        typing.Iterable[np.ndarray]
            Iterable of the anchors and handles.

Review comment (suggestion):
This doesn't make sense to me. #1302 will make alpha values less than 0 and greater than 1 raise an error, which I think is appropriate

Code after:

        Parameters
        ----------
        **kwargs
            The keyword arguments passed to :meth:`get_nth_curve_function_with_length`

        Returns
        -------
        typing.Iterable[typing.Tuple[typing.Callable[[float], np.ndarray], float]]
            The functions and lengths of the curves.
        """

        num_curves = self.get_num_curves()

        for n in range(num_curves):
            yield self.get_nth_curve_function_with_length(n, **kwargs)

    def point_from_proportion(self, alpha: float) -> np.ndarray:
        """Get the bezier curve evaluated at a position P,
        where P is the point corresponding to the proportion defined by the given alpha.

        Parameters
        ----------
        alpha : float
            Proportion.

        Returns
        -------
        np.ndarray
            Point evaluated.
        """

        if alpha == 1:
            return self.get_points()[-1]

        curves_and_lengths = tuple(self.get_curve_functions_with_lengths())

        target_length = alpha * np.sum(length for _, length in curves_and_lengths)
        current_length = 0

        for curve, length in curves_and_lengths:
            if current_length + length >= target_length:
                if length != 0:
                    residue = (target_length - current_length) / length
                else:
                    residue = 0

                return curve(residue)

            current_length += length