massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / fractions.pyi
1 import sys
2 from decimal import Decimal
3 from numbers import Integral, Rational, Real
4 from typing import Type, TypeVar, Union, overload
5 from typing_extensions import Literal
6
7 _ComparableNum = Union[int, float, Decimal, Real]
8 _T = TypeVar("_T")
9
10 if sys.version_info < (3, 9):
11     @overload
12     def gcd(a: int, b: int) -> int: ...
13     @overload
14     def gcd(a: Integral, b: int) -> Integral: ...
15     @overload
16     def gcd(a: int, b: Integral) -> Integral: ...
17     @overload
18     def gcd(a: Integral, b: Integral) -> Integral: ...
19
20 class Fraction(Rational):
21     @overload
22     def __new__(
23         cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
24     ) -> _T: ...
25     @overload
26     def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
27     @classmethod
28     def from_float(cls, f: float) -> Fraction: ...
29     @classmethod
30     def from_decimal(cls, dec: Decimal) -> Fraction: ...
31     def limit_denominator(self, max_denominator: int = ...) -> Fraction: ...
32     if sys.version_info >= (3, 8):
33         def as_integer_ratio(self) -> tuple[int, int]: ...
34     @property
35     def numerator(self) -> int: ...
36     @property
37     def denominator(self) -> int: ...
38     @overload
39     def __add__(self, other: int | Fraction) -> Fraction: ...
40     @overload
41     def __add__(self, other: float) -> float: ...
42     @overload
43     def __add__(self, other: complex) -> complex: ...
44     @overload
45     def __radd__(self, other: int | Fraction) -> Fraction: ...
46     @overload
47     def __radd__(self, other: float) -> float: ...
48     @overload
49     def __radd__(self, other: complex) -> complex: ...
50     @overload
51     def __sub__(self, other: int | Fraction) -> Fraction: ...
52     @overload
53     def __sub__(self, other: float) -> float: ...
54     @overload
55     def __sub__(self, other: complex) -> complex: ...
56     @overload
57     def __rsub__(self, other: int | Fraction) -> Fraction: ...
58     @overload
59     def __rsub__(self, other: float) -> float: ...
60     @overload
61     def __rsub__(self, other: complex) -> complex: ...
62     @overload
63     def __mul__(self, other: int | Fraction) -> Fraction: ...
64     @overload
65     def __mul__(self, other: float) -> float: ...
66     @overload
67     def __mul__(self, other: complex) -> complex: ...
68     @overload
69     def __rmul__(self, other: int | Fraction) -> Fraction: ...
70     @overload
71     def __rmul__(self, other: float) -> float: ...
72     @overload
73     def __rmul__(self, other: complex) -> complex: ...
74     @overload
75     def __truediv__(self, other: int | Fraction) -> Fraction: ...
76     @overload
77     def __truediv__(self, other: float) -> float: ...
78     @overload
79     def __truediv__(self, other: complex) -> complex: ...
80     @overload
81     def __rtruediv__(self, other: int | Fraction) -> Fraction: ...
82     @overload
83     def __rtruediv__(self, other: float) -> float: ...
84     @overload
85     def __rtruediv__(self, other: complex) -> complex: ...
86     @overload
87     def __floordiv__(self, other: int | Fraction) -> int: ...
88     @overload
89     def __floordiv__(self, other: float) -> float: ...
90     @overload
91     def __rfloordiv__(self, other: int | Fraction) -> int: ...
92     @overload
93     def __rfloordiv__(self, other: float) -> float: ...
94     @overload
95     def __mod__(self, other: int | Fraction) -> Fraction: ...
96     @overload
97     def __mod__(self, other: float) -> float: ...
98     @overload
99     def __rmod__(self, other: int | Fraction) -> Fraction: ...
100     @overload
101     def __rmod__(self, other: float) -> float: ...
102     @overload
103     def __divmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
104     @overload
105     def __divmod__(self, other: float) -> tuple[float, Fraction]: ...
106     @overload
107     def __rdivmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
108     @overload
109     def __rdivmod__(self, other: float) -> tuple[float, Fraction]: ...
110     @overload
111     def __pow__(self, other: int) -> Fraction: ...
112     @overload
113     def __pow__(self, other: float | Fraction) -> float: ...
114     @overload
115     def __pow__(self, other: complex) -> complex: ...
116     @overload
117     def __rpow__(self, other: int | float | Fraction) -> float: ...
118     @overload
119     def __rpow__(self, other: complex) -> complex: ...
120     def __pos__(self) -> Fraction: ...
121     def __neg__(self) -> Fraction: ...
122     def __abs__(self) -> Fraction: ...
123     def __trunc__(self) -> int: ...
124     def __floor__(self) -> int: ...
125     def __ceil__(self) -> int: ...
126     @overload
127     def __round__(self, ndigits: None = ...) -> int: ...
128     @overload
129     def __round__(self, ndigits: int) -> Fraction: ...
130     def __hash__(self) -> int: ...
131     def __eq__(self, other: object) -> bool: ...
132     def __lt__(self, other: _ComparableNum) -> bool: ...
133     def __gt__(self, other: _ComparableNum) -> bool: ...
134     def __le__(self, other: _ComparableNum) -> bool: ...
135     def __ge__(self, other: _ComparableNum) -> bool: ...
136     def __bool__(self) -> bool: ...
137     if sys.version_info >= (3, 11):
138         def __int__(self) -> int: ...
139     # Not actually defined within fractions.py, but provides more useful
140     # overrides
141     @property
142     def real(self) -> Fraction: ...
143     @property
144     def imag(self) -> Literal[0]: ...
145     def conjugate(self) -> Fraction: ...