grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|jl(ã@s�dZddlmZmZgd¢ZGdd„ded�ZGdd„deƒZe e¡Gd d „d eƒZ e  e ¡Gd d „d e ƒZ Gd d„de ƒZ e  e ¡dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.é)ÚABCMetaÚabstractmethod)ÚNumberÚComplexÚRealÚRationalÚIntegralc@seZdZdZdZdZdS)rzŸAll numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). ©N)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__Ú__hash__r r r ú./opt/alt/python310/lib64/python3.10/numbers.pyr sr)Ú metaclassc@sôeZdZdZdZedd„ƒZdd„Zeedd„ƒƒZ eed d „ƒƒZ ed d „ƒZ ed d„ƒZ edd„ƒZ edd„ƒZdd„Zdd„Zedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd „ƒZed!d"„ƒZed#d$„ƒZed%d&„ƒZed'd(„ƒZd)S)*rafComplex defines the operations that work on the builtin complex type. In short, those are: a conversion to complex, .real, .imag, +, -, *, /, **, abs(), .conjugate, ==, and !=. If it is given heterogeneous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. r cCódS)zrz Complex.imagcCr)z self + otherr©rÚotherr r rÚ__add__GózComplex.__add__cCr)z other + selfrrr r rÚ__radd__Lr!zComplex.__radd__cCr)z-selfrrr r rÚ__neg__Qr!zComplex.__neg__cCr)z+selfrrr r rÚ__pos__Vr!zComplex.__pos__cCs || S)z self - otherr rr r rÚ__sub__[ó zComplex.__sub__cCs | |S)z other - selfr rr r rÚ__rsub___r&zComplex.__rsub__cCr)z self * otherrrr r rÚ__mul__cr!zComplex.__mul__cCr)z other * selfrrr r rÚ__rmul__hr!zComplex.__rmul__cCr)z5self / other: Should promote to float when necessary.rrr r rÚ __truediv__mr!zComplex.__truediv__cCr)z other / selfrrr r rÚ __rtruediv__rr!zComplex.__rtruediv__cCr)zBself**exponent; should promote to float or complex when necessary.r)rÚexponentr r rÚ__pow__wr!zComplex.__pow__cCr)z base ** selfr)rÚbaser r rÚ__rpow__|r!zComplex.__rpow__cCr)z7Returns the Real distance from 0. Called for abs(self).rrr r rÚ__abs__�r!zComplex.__abs__cCr)z$(x+y*i).conjugate() returns (x-y*i).rrr r rÚ conjugate†r!zComplex.conjugatecCr)z self == otherrrr r rÚ__eq__‹r!zComplex.__eq__N)r r r r rrrrÚpropertyrrr r"r#r$r%r'r(r)r*r+r-r/r0r1r2r r r rr sP                rc@sÒeZdZdZdZedd„ƒZedd„ƒZedd„ƒZed d „ƒZ ed&d d „ƒZ dd„Z dd„Z edd„ƒZ edd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZdd„Zed d!„ƒZed"d#„ƒZd$d%„Zd S)'rzÜTo Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=. Real also provides defaults for the derived operations. r cCr)zTAny Real can be converted to a native float object. Called for float(self).rrr r rÚ __float__žózReal.__float__cCr)aGtrunc(self): Truncates self to an Integral. Returns an Integral i such that: * i>0 iff self>0; * abs(i) <= abs(self); * for any Integral j satisfying the first two conditions, abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. i.e. "truncate towards 0". rrr r rÚ __trunc__¥s zReal.__trunc__cCr)z$Finds the greatest Integral <= self.rrr r rÚ __floor__²r!zReal.__floor__cCr)z!Finds the least Integral >= self.rrr r rÚ__ceil__·r!z Real.__ceil__NcCr)z¸Rounds self to ndigits decimal places, defaulting to 0. If ndigits is omitted or None, returns an Integral, otherwise returns a Real. Rounds half toward even. r)rZndigitsr r rÚ __round__¼rzReal.__round__cCs||||fS)z™divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r rr r rÚ __divmod__ÅózReal.__divmod__cCs||||fS)z™divmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r rr r rÚ __rdivmod__Ír;zReal.__rdivmod__cCr)z)self // other: The floor() of self/other.rrr r rÚ __floordiv__Õr!zReal.__floordiv__cCr)z)other // self: The floor() of other/self.rrr r rÚ __rfloordiv__Úr!zReal.__rfloordiv__cCr)z self % otherrrr r rÚ__mod__ßr!z Real.__mod__cCr)z other % selfrrr r rÚ__rmod__är!z Real.__rmod__cCr)zRself < other < on Reals defines a total ordering, except perhaps for NaN.rrr r rÚ__lt__ér5z Real.__lt__cCr)z self <= otherrrr r rÚ__le__ðr!z Real.__le__cCó tt|ƒƒS)z(complex(self) == complex(float(self), 0))ÚcomplexÚfloatrr r rröó zReal.__complex__cCó| S)z&Real numbers are their real component.r rr r rrúóz Real.realcCr)z)Real numbers have no imaginary component.rr rr r rrÿr!z Real.imagcCrG)zConjugate is a no-op for Reals.r rr r rr1szReal.conjugate©N)r r r r rrr4r6r7r8r9r:r<r=r>r?r@rArBrr3rrr1r r r rr“sB              rc@s<eZdZdZdZeedd„ƒƒZeedd„ƒƒZdd„Z d S) rz6.numerator and .denominator should be in lowest terms.r cCrrIrrr r rÚ numeratorr!zRational.numeratorcCrrIrrr r rÚ denominatorr!zRational.denominatorcCst|jƒt|jƒS)a float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. )ÚintrJrKrr r rr4szRational.__float__N) r r r r rr3rrJrKr4r r r rr s   rc@sÚeZdZdZdZedd„ƒZdd„Zed&dd „ƒZed d „ƒZ ed d „ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZd d!„Zed"d#„ƒZed$d%„ƒZdS)'rzšIntegral adds methods that work on integral numbers. In short, these are conversion to int, pow with modulus, and the bit-string operations. r cCr)z int(self)rrr r rÚ__int__/r!zIntegral.__int__cCst|ƒS)z6Called whenever an index is needed, such as in slicing)rLrr r rÚ __index__4rzIntegral.__index__NcCr)a4self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex. r)rr,Úmodulusr r rr-8s zIntegral.__pow__cCr)z self << otherrrr r rÚ __lshift__Cr!zIntegral.__lshift__cCr)z other << selfrrr r rÚ __rlshift__Hr!zIntegral.__rlshift__cCr)z self >> otherrrr r rÚ __rshift__Mr!zIntegral.__rshift__cCr)z other >> selfrrr r rÚ __rrshift__Rr!zIntegral.__rrshift__cCr)z self & otherrrr r rÚ__and__Wr!zIntegral.__and__cCr)z other & selfrrr r rÚ__rand__\r!zIntegral.__rand__cCr)z self ^ otherrrr r rÚ__xor__ar!zIntegral.__xor__cCr)z other ^ selfrrr r rÚ__rxor__fr!zIntegral.__rxor__cCr)z self | otherrrr r rÚ__or__kr!zIntegral.__or__cCr)z other | selfrrr r rÚ__ror__pr!zIntegral.__ror__cCr)z~selfrrr r rÚ __invert__ur!zIntegral.__invert__cCrC)zfloat(self) == float(int(self)))rErLrr r rr4{rFzIntegral.__float__cCrG)z"Integers are their own numerators.r rr r rrJrHzIntegral.numeratorcCr)z!Integers have a denominator of 1.ér rr r rrK„r!zIntegral.denominatorrI)r r r r rrrMrNr-rPrQrRrSrTrUrVrWrXrYrZr4r3rJrKr r r rr&sF              rN)r ÚabcrrÚ__all__rrÚregisterrDrrErrrLr r r rÚs p uc