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

Code before:
    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: Any,
    ):
        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)

        if isinstance(text, (tuple, list)):
            self.label: VMobject = self.label_constructor(
                *text, font_size=font_size, **kwargs
            )
        else:
            self.label = self.label_constructor(str(text), font_size=font_size)

        self.brace.put_at_tip(self.label)
        self.add(self.brace, self.label)

    def creation_anim(

Review comment (suggestion):
The `label_constructor` above could be typed as `type[SingleStringMathTex | Text]` to allow passing both TeX and Cairo-rendered texts. `SingleStringMathTex` is the parent of `MathTex`, which is the parent of `Tex`, which is the parent of `BulletedList` and `Title`.

Plus, the `brace_direction` could be typed as `Point3DLike` (in the future, `Vector3DLike`).

Code after:
    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: Point3DLike = DOWN,
        label_constructor: type[SingleStringMathTex | Text] = MathTex,
        font_size: float = DEFAULT_FONT_SIZE,
        buff: float = 0.2,
        brace_config: dict[str, Any] | None = None,
        **kwargs: Any,
    ):
        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)

        if isinstance(text, (tuple, list)):
            self.label: VMobject = self.label_constructor(
                *text, font_size=font_size, **kwargs
            )
        else:
            self.label = self.label_constructor(str(text), font_size=font_size)

        self.brace.put_at_tip(self.label)
        self.add(self.brace, self.label)

    def creation_anim(
        self,
        label_anim: type[Animation] = FadeIn,