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

Code before:

            # TODO: remove this check and ability to call
            # this method via CoordinateSystem.add_coordinates()
            # must be explicitly called
            if isinstance(label, str) and self.label_constructor is MathTex:
                label = Tex(label)
            else:
                label = self._create_label_tex(label)

            if hasattr(label, "font_size"):
                label.font_size = font_size
            else:
                raise AttributeError(f"{label} is not compatible with add_labels.")
            label.next_to(self.number_to_point(x), direction=direction, buff=buff)
            labels.add(label)

        self.labels = labels
        self.add(labels)
        return self

    def _create_label_tex(self, label_tex: Union[str, float, VMobject]) -> VMobject:
        """Checks if the label is a :class:`~.VMobject`, otherwise, creates a label according to the label_constructor.

        Parameters
        ----------
        label_tex : The label to be compared against the above types.
        label_constructor : The VMobject class used to construct the label.

        Returns
        -------
        :class:`~.VMobject`
            The label.
        """

        if isinstance(label_tex, VMobject):
            return label_tex
        else:
            return self.label_constructor(label_tex)

    @staticmethod
    def _decimal_places_from_step(step) -> int:
        step = str(step)
        if "." not in step:
            return 0
        return len(step.split(".")[-1])


class UnitInterval(NumberLine):
    def __init__(
        self,
        unit_size=10,

Review comment (suggestion):
```suggestion
        label_tex
            The label to be compared against the above types.
```

Code after:

            # TODO: remove this check and ability to call
            # this method via CoordinateSystem.add_coordinates()
            # must be explicitly called
            if isinstance(label, str) and self.label_constructor is MathTex:
                label = Tex(label)
            else:
                label = self._create_label_tex(label)

            if hasattr(label, "font_size"):
                label.font_size = font_size
            else:
                raise AttributeError(f"{label} is not compatible with add_labels.")
            label.next_to(self.number_to_point(x), direction=direction, buff=buff)
            labels.add(label)

        self.labels = labels
        self.add(labels)
        return self

    def _create_label_tex(self, label_tex: Union[str, float, VMobject]) -> VMobject:
        """Checks if the label is a :class:`~.VMobject`, otherwise, creates a
        label according to the ``label_constructor``.

        Parameters
        ----------
        label_tex
            The label to be compared against the above types.
        label_constructor
            The VMobject class used to construct the label.

        Returns
        -------
        :class:`~.VMobject`
            The label.
        """

        if isinstance(label_tex, VMobject):
            return label_tex
        else:
            return self.label_constructor(label_tex)

    @staticmethod
    def _decimal_places_from_step(step) -> int:
        step = str(step)
        if "." not in step:
            return 0
        return len(step.split(".")[-1])


class UnitInterval(NumberLine):