Repository: ManimCommunity/manim
File: manim/mobject/geometry/line.py (Python)

Code before:
            end=self.end,
            buff=self.buff,
            path_arc=self.path_arc,
        )

    def set_points_by_ends(
        self,
        start: Point3D | Mobject,
        end: Point3D | Mobject,
        buff: float = 0,
        path_arc: float = 0,
    ) -> None:
        """Sets the points of the line based on its start and end points.
        Unlike :meth:`put_start_and_end_on`, this method respects `self.buff` and
        Mobject bounding boxes.

        Parameters
        ----------
        start : Point3D | Mobject
            The start point or Mobject of the line.
        end : Point3D | Mobject
            The end point or Mobject of the line.
        buff : float, optional
            The empty space between start and end and the line, by default 0
        path_arc : float, optional
            The angle of a circle spanned by this arc, by default 0 which is a straight line.
        """
        self._set_start_and_end_attrs(start, end)
        if path_arc:
            arc = ArcBetweenPoints(self.start, self.end, angle=self.path_arc)
            self.set_points(arc.points)
        else:
            self.set_points_as_corners([self.start, self.end])

        self._account_for_buff(buff)

    init_points = generate_points

    def _account_for_buff(self, buff: float) -> Self:
        if buff == 0:
            return
        #
        if self.path_arc == 0:
            length = self.get_length()
        else:
            length = self.get_arc_length()
        #
        if length < 2 * buff:
            return
        buff_proportion = buff / length
        self.pointwise_become_partial(self, buff_proportion, 1 - buff_proportion)

Review comment (suggestion):
When adding docstrings to a method, it is not necessary to repeat the parameter type hints inside the docstring: only add typings directly to the signature.

I also slightly modified the `buff` description.

```suggestion
        start
            The start point or Mobject of the line.
        end
            The end point or Mobject of the line.
        buff
            The empty space between the start and end of the line, by default 0.
        path_arc
            The angle of a circle spanned by this arc, by default 0 which is a straight line.
```

Code after:
            end=self.end,
            buff=self.buff,
            path_arc=self.path_arc,
        )

    def set_points_by_ends(
        self,
        start: Point3D | Mobject,
        end: Point3D | Mobject,
        buff: float = 0,
        path_arc: float = 0,
    ) -> None:
        """Sets the points of the line based on its start and end points.
        Unlike :meth:`put_start_and_end_on`, this method respects `self.buff` and
        Mobject bounding boxes.

        Parameters
        ----------
        start
            The start point or Mobject of the line.
        end
            The end point or Mobject of the line.
        buff
            The empty space between the start and end of the line, by default 0.
        path_arc
            The angle of a circle spanned by this arc, by default 0 which is a straight line.
        """
        self._set_start_and_end_attrs(start, end)
        if path_arc:
            arc = ArcBetweenPoints(self.start, self.end, angle=self.path_arc)
            self.set_points(arc.points)
        else:
            self.set_points_as_corners([self.start, self.end])

        self._account_for_buff(buff)

    init_points = generate_points

    def _account_for_buff(self, buff: float) -> Self:
        if buff == 0:
            return
        #
        if self.path_arc == 0:
            length = self.get_length()
        else:
            length = self.get_arc_length()
        #
        if length < 2 * buff:
            return
        buff_proportion = buff / length
        self.pointwise_become_partial(self, buff_proportion, 1 - buff_proportion)