@classmethod
    def from_float(cls, f):
        """Converts a finite float to a rational number, exactly.

        Beware that Fraction.from_float(0.3) != Fraction(3, 10).

        """
        if isinstance(f, numbers.Integral):
            return cls(f)
        elif not isinstance(f, float):
            raise TypeError("%s.from_float() only takes floats, not %r (%s)" %
                            (cls.__name__, f, type(f).__name__))
        if math.isnan(f):
            raise ValueError("Cannot convert %r to %s." % (f, cls.__name__))
        if math.isinf(f):
            raise OverflowError((f, cls.__name__) % "Cannot convert %r to %s.")
        return cls(*f.as_integer_ratio())
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/fractions.py/Fraction.from_float/swapped operands of `%`