Repository: ManimCommunity/manim
File: manim/mobject/svg/brace.py (Python)

Code before:

        return self.points[28]  # = 7*4

    def get_direction(self):
        vect = self.get_tip() - self.get_center()
        return vect / np.linalg.norm(vect)


class BraceLabel(VMobject, metaclass=ConvertToOpenGL):
    """Create a brace with a label attached.

    Parameters
    ----------
    obj
        The mobject adjacent to which the brace is placed
    text
        label text
    brace_direction:vector default=DOWN
    label_constructor default=MathTex,
    font_size: float default=DEFAULT_FONT_SIZE,
    buff: int, default=0.2
        buff between label and obj
    brace_config: dict, optional
        Arguments to be passed to :class:`Brace`.
    kwargs
        Additional arguments to be passed to :class:`~.VMobject`.
    """

    def __init__(
        self,
        obj,
        text,
        brace_direction=DOWN,
        label_constructor=MathTex,
        font_size=DEFAULT_FONT_SIZE,
        buff=0.2,
        brace_config: dict | None = None,
        **kwargs,
    ):
        self.label_constructor = label_constructor
        super().__init__(**kwargs)

        self.brace_direction = brace_direction
        self.buff = buff
        if isinstance(obj, list):
            obj = self.get_group_class()(*obj)
        if brace_config is None:
            self.brace_config = {}
        else:
            self.brace_config = brace_config
        self.brace = Brace(obj, brace_direction, buff, **self.brace_config)

Review comment (suggestion):
Some improvements to the documentation of some of the parameters.

```suggestion
    obj
        The mobject adjacent to which the brace is placed.
    text
        The label text.
    brace_direction
        The direction of the brace. By default ``DOWN``.
    label_constructor
        A class or function used to construct a mobject representing
        the label. By default :class:`~.MathTex`.
    font_size
        The font size of the label, passed to the ``label_constructor``.
    buff
        The buffer between the mobject and thre brace.
    brace_config
        Arguments to be passed to :class:`.Brace`.
    kwargs
        Additional arguments to be passed to :class:`~.VMobject`.
```

Code after:

        return self.points[28]  # = 7*4

    def get_direction(self):
        vect = self.get_tip() - self.get_center()
        return vect / np.linalg.norm(vect)


class BraceLabel(VMobject, metaclass=ConvertToOpenGL):
    """Create a brace with a label attached.

    Parameters
    ----------
    obj
        The mobject adjacent to which the brace is placed.
    text
        The label text.
    brace_direction
        The direction of the brace. By default ``DOWN``.
    label_constructor
        A class or function used to construct a mobject representing
        the label. By default :class:`~.MathTex`.
    font_size
        The font size of the label, passed to the ``label_constructor``.
    buff
        The buffer between the mobject and the brace.
    brace_config
        Arguments to be passed to :class:`.Brace`.
    kwargs
        Additional arguments to be passed to :class:`~.VMobject`.
    """

    def __init__(
        self,
        obj: Mobject,
        text: str,
        brace_direction: np.ndarray = DOWN,
        label_constructor: type = MathTex,
        font_size: float = DEFAULT_FONT_SIZE,
        buff: float = 0.2,
        brace_config: dict | None = None,
        **kwargs,
    ):
        self.label_constructor = label_constructor
        super().__init__(**kwargs)

        self.brace_direction = brace_direction
        if brace_config is None:
            brace_config = {}
        self.brace = Brace(obj, brace_direction, buff, **brace_config)