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

Code before:
        """Get the current value of this ValueTracker."""
        value: float = self.points[0, 0]
        return value

    def set_value(self, value: float) -> Self:
        """Sets a new scalar value to the ValueTracker."""
        self.points[0, 0] = value
        return self

    def increment_value(self, d_value: float) -> Self:
        """Increments (adds) a scalar value to the ValueTracker."""
        self.set_value(self.get_value() + d_value)
        return self

    def __bool__(self) -> bool:
        """Return whether the value of this ValueTracker evaluates as true."""
        return bool(self.get_value())

    def __iadd__(self, d_value: float | Mobject) -> Self:
        """adds ``+=`` syntax to increment the value of the ValueTracker."""
        if isinstance(d_value, Mobject):
            raise ValueError(
                "Cannot increment ValueTracker by a Mobject. Please provide a scalar value."
            )
        else:
            self.increment_value(d_value)
        return self

    def __ifloordiv__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the floor division of the current value by ``d_value``."""
        self.set_value(self.get_value() // d_value)
        return self

    def __imod__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the current value modulo ``d_value``."""
        self.set_value(self.get_value() % d_value)
        return self

    def __imul__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the product of the current value and ``d_value``."""
        self.set_value(self.get_value() * d_value)
        return self

    def __ipow__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the current value raised to the power of ``d_value``."""
        self.set_value(self.get_value() ** d_value)
        return self

    def __sub__(self, d_value: float | Mobject) -> Self:
        """Decrements the ValueTracker by ``d_value``."""
        if isinstance(d_value, Mobject):

Review comment (suggestion):
Minor nitpick: the `else` branch is not necessary, since the main `if` branch ends with an error. Having the `return self` statement outside of the `else` branch looks slightly weird in this case, so I'd suggest deleting the `else`.
```suggestion
        self.increment_value(d_value)
```

Code after:
        """Get the current value of this ValueTracker."""
        value: float = self.points[0, 0]
        return value

    def set_value(self, value: float) -> Self:
        """Sets a new scalar value to the ValueTracker."""
        self.points[0, 0] = value
        return self

    def increment_value(self, d_value: float) -> Self:
        """Increments (adds) a scalar value to the ValueTracker."""
        self.set_value(self.get_value() + d_value)
        return self

    def __bool__(self) -> bool:
        """Return whether the value of this ValueTracker evaluates as true."""
        return bool(self.get_value())

    def __add__(self, d_value: float | Mobject) -> ValueTracker:
        """Return a new :class:`ValueTracker` whose value is the current tracker's value plus
        ``d_value``.
        """
        if isinstance(d_value, Mobject):
            raise ValueError(
                "Cannot increment ValueTracker by a Mobject. Please provide a scalar value."
            )
        return ValueTracker(self.get_value() + d_value)

    def __iadd__(self, d_value: float | Mobject) -> Self:
        """adds ``+=`` syntax to increment the value of the ValueTracker."""
        if isinstance(d_value, Mobject):
            raise ValueError(
                "Cannot increment ValueTracker by a Mobject. Please provide a scalar value."
            )
        self.increment_value(d_value)
        return self

    def __ifloordiv__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the floor division of the current value by ``d_value``."""
        self.set_value(self.get_value() // d_value)
        return self

    def __imod__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the current value modulo ``d_value``."""
        self.set_value(self.get_value() % d_value)
        return self

    def __imul__(self, d_value: float) -> Self:
        """Set the value of this ValueTracker to the product of the current value and ``d_value``."""
        self.set_value(self.get_value() * d_value)
        return self