--- /dev/null
+# Stubs for fractions\r
+# See https://docs.python.org/3/library/fractions.html\r
+#\r
+# Note: these stubs are incomplete. The more complex type\r
+# signatures are currently omitted. Also see numbers.pyi.\r
+\r
+from typing import Optional, TypeVar, Union, overload\r
+from numbers import Real, Integral, Rational\r
+from decimal import Decimal\r
+import sys\r
+\r
+_ComparableNum = Union[int, float, Decimal, Real]\r
+\r
+\r
+@overload\r
+def gcd(a: int, b: int) -> int: ...\r
+@overload\r
+def gcd(a: Integral, b: int) -> Integral: ...\r
+@overload\r
+def gcd(a: int, b: Integral) -> Integral: ...\r
+@overload\r
+def gcd(a: Integral, b: Integral) -> Integral: ...\r
+\r
+\r
+class Fraction(Rational):\r
+ @overload\r
+ def __init__(self,\r
+ numerator: Union[int, Rational] = ...,\r
+ denominator: Optional[Union[int, Rational]] = ...,\r
+ *,\r
+ _normalize: bool = ...) -> None: ...\r
+ @overload\r
+ def __init__(self, value: float, *, _normalize: bool = ...) -> None: ...\r
+ @overload\r
+ def __init__(self, value: Decimal, *, _normalize: bool = ...) -> None: ...\r
+ @overload\r
+ def __init__(self, value: str, *, _normalize: bool = ...) -> None: ...\r
+\r
+ @classmethod\r
+ def from_float(cls, f: float) -> 'Fraction': ...\r
+ @classmethod\r
+ def from_decimal(cls, dec: Decimal) -> 'Fraction': ...\r
+ def limit_denominator(self, max_denominator: int = ...) -> 'Fraction': ...\r
+\r
+ @property\r
+ def numerator(self) -> int: ...\r
+ @property\r
+ def denominator(self) -> int: ...\r
+\r
+ def __add__(self, other): ...\r
+ def __radd__(self, other): ...\r
+ def __sub__(self, other): ...\r
+ def __rsub__(self, other): ...\r
+ def __mul__(self, other): ...\r
+ def __rmul__(self, other): ...\r
+ def __truediv__(self, other): ...\r
+ def __rtruediv__(self, other): ...\r
+ if sys.version_info < (3, 0):\r
+ def __div__(self, other): ...\r
+ def __rdiv__(self, other): ...\r
+ def __floordiv__(self, other) -> int: ...\r
+ def __rfloordiv__(self, other) -> int: ...\r
+ def __mod__(self, other): ...\r
+ def __rmod__(self, other): ...\r
+ def __divmod__(self, other): ...\r
+ def __rdivmod__(self, other): ...\r
+ def __pow__(self, other): ...\r
+ def __rpow__(self, other): ...\r
+\r
+ def __pos__(self) -> 'Fraction': ...\r
+ def __neg__(self) -> 'Fraction': ...\r
+ def __abs__(self) -> 'Fraction': ...\r
+ def __trunc__(self) -> int: ...\r
+ if sys.version_info >= (3, 0):\r
+ def __floor__(self) -> int: ...\r
+ def __ceil__(self) -> int: ...\r
+ def __round__(self, ndigits=None): ...\r
+\r
+ def __hash__(self) -> int: ...\r
+ def __eq__(self, other: object) -> bool: ...\r
+ def __lt__(self, other: _ComparableNum) -> bool: ...\r
+ def __gt__(self, other: _ComparableNum) -> bool: ...\r
+ def __le__(self, other: _ComparableNum) -> bool: ...\r
+ def __ge__(self, other: _ComparableNum) -> bool: ...\r
+ if sys.version_info >= (3, 0):\r
+ def __bool__(self) -> bool: ...\r
+ else:\r
+ def __nonzero__(self) -> bool: ...\r
+\r
+ # Not actually defined within fractions.py, but provides more useful\r
+ # overrides\r
+ @property\r
+ def real(self) -> 'Fraction': ...\r
+ @property\r
+ def imag(self) -> 'Fraction': ...\r
+ def conjugate(self) -> 'Fraction': ...\r