Repository: ManimCommunity/manim
File: manim/mobject/text/text_mobject.py (Python)

Code before:

    """

    @staticmethod
    @functools.cache
    def font_list() -> list[str]:
        value: list[str] = manimpango.list_fonts()
        return value

    def __init__(
        self,
        text: str,
        fill_opacity: float = 1.0,
        stroke_width: float = 0,
        color: ParsableManimColor | None = None,
        font_size: float = DEFAULT_FONT_SIZE,
        line_spacing: float = -1,
        font: str = "",
        slant: str = NORMAL,
        weight: str = NORMAL,
        t2c: dict[str, str] | None = None,
        t2f: dict[str, str] | None = None,
        t2g: dict[str, tuple] | None = None,
        t2s: dict[str, str] | None = None,
        t2w: dict[str, str] | None = None,
        gradient: tuple | None = None,
        tab_width: int = 4,
        warn_missing_font: bool = True,
        # Mobject
        height: float | None = None,
        width: float | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        use_svg_cache: bool = False,
        **kwargs: Any,
    ):
        self.line_spacing = line_spacing
        if font and warn_missing_font:
            fonts_list = Text.font_list()
            # handle special case of sans/sans-serif
            if font.lower() == "sans-serif":
                font = "sans"
            if font not in fonts_list:
                # check if the capitalized version is in the supported fonts
                if font.capitalize() in fonts_list:
                    font = font.capitalize()
                elif font.lower() in fonts_list:
                    font = font.lower()
                elif font.title() in fonts_list:
                    font = font.title()
                else:

Review comment (suggestion):
Since `gradient` is passed as an argument to `color_gradient`, it can be further specified as `Sequence[ParsableManimColor]`. Moreover, if you commit the suggestions I made in #4380, it could even be an `Iterable[ParsableManimColor]`...

_Edited since #4380 was merged_
```suggestion
        gradient: Iterable[ParsableManimColor] | None = None,
```

Code after:

    @staticmethod
    @functools.cache
    def font_list() -> list[str]:
        value: list[str] = manimpango.list_fonts()
        return value

    def __init__(
        self,
        text: str,
        fill_opacity: float = 1.0,
        stroke_width: float = 0,
        color: ParsableManimColor | None = None,
        font_size: float = DEFAULT_FONT_SIZE,
        line_spacing: float = -1,
        font: str = "",
        slant: str = NORMAL,
        weight: str = NORMAL,
        t2c: dict[str, str] | None = None,
        t2f: dict[str, str] | None = None,
        t2g: dict[str, Iterable[ParsableManimColor]] | None = None,
        t2s: dict[str, str] | None = None,
        t2w: dict[str, str] | None = None,
        gradient: Iterable[ParsableManimColor] | None = None,
        tab_width: int = 4,
        warn_missing_font: bool = True,
        # Mobject
        height: float | None = None,
        width: float | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        use_svg_cache: bool = False,
        **kwargs: Any,
    ):
        self.line_spacing = line_spacing
        if font and warn_missing_font:
            fonts_list = Text.font_list()
            # handle special case of sans/sans-serif
            if font.lower() == "sans-serif":
                font = "sans"
            if font not in fonts_list:
                # check if the capitalized version is in the supported fonts
                if font.capitalize() in fonts_list:
                    font = font.capitalize()
                elif font.lower() in fonts_list:
                    font = font.lower()
                elif font.title() in fonts_list:
                    font = font.title()
                else:
                    logger.warning(f"Font {font} not in {fonts_list}.")
        self.font = font