massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / fractions.pyi
1 # Stubs for fractions\r
2 # See https://docs.python.org/3/library/fractions.html\r
3 #\r
4 # Note: these stubs are incomplete. The more complex type\r
5 # signatures are currently omitted. Also see numbers.pyi.\r
6 \r
7 from typing import Optional, TypeVar, Union, overload\r
8 from numbers import Real, Integral, Rational\r
9 from decimal import Decimal\r
10 import sys\r
11 \r
12 _ComparableNum = Union[int, float, Decimal, Real]\r
13 \r
14 \r
15 @overload\r
16 def gcd(a: int, b: int) -> int: ...\r
17 @overload\r
18 def gcd(a: Integral, b: int) -> Integral: ...\r
19 @overload\r
20 def gcd(a: int, b: Integral) -> Integral: ...\r
21 @overload\r
22 def gcd(a: Integral, b: Integral) -> Integral: ...\r
23 \r
24 \r
25 class Fraction(Rational):\r
26     @overload\r
27     def __init__(self,\r
28                  numerator: Union[int, Rational] = ...,\r
29                  denominator: Optional[Union[int, Rational]] = ...,\r
30                  *,\r
31                  _normalize: bool = ...) -> None: ...\r
32     @overload\r
33     def __init__(self, value: float, *, _normalize: bool = ...) -> None: ...\r
34     @overload\r
35     def __init__(self, value: Decimal, *, _normalize: bool = ...) -> None: ...\r
36     @overload\r
37     def __init__(self, value: str, *, _normalize: bool = ...) -> None: ...\r
38 \r
39     @classmethod\r
40     def from_float(cls, f: float) -> 'Fraction': ...\r
41     @classmethod\r
42     def from_decimal(cls, dec: Decimal) -> 'Fraction': ...\r
43     def limit_denominator(self, max_denominator: int = ...) -> 'Fraction': ...\r
44 \r
45     @property\r
46     def numerator(self) -> int: ...\r
47     @property\r
48     def denominator(self) -> int: ...\r
49 \r
50     def __add__(self, other): ...\r
51     def __radd__(self, other): ...\r
52     def __sub__(self, other): ...\r
53     def __rsub__(self, other): ...\r
54     def __mul__(self, other): ...\r
55     def __rmul__(self, other): ...\r
56     def __truediv__(self, other): ...\r
57     def __rtruediv__(self, other): ...\r
58     if sys.version_info < (3, 0):\r
59         def __div__(self, other): ...\r
60         def __rdiv__(self, other): ...\r
61     def __floordiv__(self, other) -> int: ...\r
62     def __rfloordiv__(self, other) -> int: ...\r
63     def __mod__(self, other): ...\r
64     def __rmod__(self, other): ...\r
65     def __divmod__(self, other): ...\r
66     def __rdivmod__(self, other): ...\r
67     def __pow__(self, other): ...\r
68     def __rpow__(self, other): ...\r
69 \r
70     def __pos__(self) -> 'Fraction': ...\r
71     def __neg__(self) -> 'Fraction': ...\r
72     def __abs__(self) -> 'Fraction': ...\r
73     def __trunc__(self) -> int: ...\r
74     if sys.version_info >= (3, 0):\r
75         def __floor__(self) -> int: ...\r
76         def __ceil__(self) -> int: ...\r
77         def __round__(self, ndigits=None): ...\r
78 \r
79     def __hash__(self) -> int: ...\r
80     def __eq__(self, other: object) -> bool: ...\r
81     def __lt__(self, other: _ComparableNum) -> bool: ...\r
82     def __gt__(self, other: _ComparableNum) -> bool: ...\r
83     def __le__(self, other: _ComparableNum) -> bool: ...\r
84     def __ge__(self, other: _ComparableNum) -> bool: ...\r
85     if sys.version_info >= (3, 0):\r
86         def __bool__(self) -> bool: ...\r
87     else:\r
88         def __nonzero__(self) -> bool: ...\r
89 \r
90     # Not actually defined within fractions.py, but provides more useful\r
91     # overrides\r
92     @property\r
93     def real(self) -> 'Fraction': ...\r
94     @property\r
95     def imag(self) -> 'Fraction': ...\r
96     def conjugate(self) -> 'Fraction': ...\r