Ë
    òT•jË,  ã                   óö   — d Z ddlmZmZ g d¢Z G d„ de¬«      Z G d„ de«      Zej                  e«        G d	„ d
e«      Z	e	j                  e
«        G d„ de	«      Z G d„ de«      Zej                  e«       y)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                   ó   — e Zd ZdZdZdZy)r   zŸ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   ó    ú/usr/lib/python3.12/numbers.pyr   r   %   s   „ ñð
 €Ið �Hr   r   )Ú	metaclassc                   ó:  — e Zd ZdZdZed„ «       Zd„ Zeed„ «       «       Z	eed„ «       «       Z
ed„ «       Zed„ «       Zed	„ «       Zed
„ «       Zd„ Zd„ Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zy)r   af  Complex 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   c                  ó   — y)z<Return a builtin complex instance. Called for complex(self).Nr   ©Úselfs    r   Ú__complex__zComplex.__complex__F   s   � r   c                 ó   — | dk7  S )z)True if self != 0. Called for bool(self).r   r   r   s    r   Ú__bool__zComplex.__bool__J   s   € à�q‰yÐr   c                 ó   — t         ‚)zXRetrieve the real component of this number.

        This should subclass Real.
        ©ÚNotImplementedErrorr   s    r   ÚrealzComplex.realN   ó
   € ô "Ð!r   c                 ó   — t         ‚)z]Retrieve the imaginary component of this number.

        This should subclass Real.
        r   r   s    r   ÚimagzComplex.imagW   r    r   c                 ó   — t         ‚)zself + otherr   ©r   Úothers     r   Ú__add__zComplex.__add__`   ó
   € ô "Ð!r   c                 ó   — t         ‚)zother + selfr   r$   s     r   Ú__radd__zComplex.__radd__e   r'   r   c                 ó   — t         ‚)z-selfr   r   s    r   Ú__neg__zComplex.__neg__j   r'   r   c                 ó   — t         ‚)z+selfr   r   s    r   Ú__pos__zComplex.__pos__o   r'   r   c                 ó   — | | z   S )zself - otherr   r$   s     r   Ú__sub__zComplex.__sub__t   s   € à�u�f‰}Ðr   c                 ó   — |  |z   S )zother - selfr   r$   s     r   Ú__rsub__zComplex.__rsub__x   s   € àˆu�u‰}Ðr   c                 ó   — t         ‚)zself * otherr   r$   s     r   Ú__mul__zComplex.__mul__|   r'   r   c                 ó   — t         ‚)zother * selfr   r$   s     r   Ú__rmul__zComplex.__rmul__�   r'   r   c                 ó   — t         ‚)z5self / other: Should promote to float when necessary.r   r$   s     r   Ú__truediv__zComplex.__truediv__†   r'   r   c                 ó   — t         ‚)zother / selfr   r$   s     r   Ú__rtruediv__zComplex.__rtruediv__‹   r'   r   c                 ó   — t         ‚)zDself ** exponent; should promote to float or complex when necessary.r   )r   Úexponents     r   Ú__pow__zComplex.__pow__�   r'   r   c                 ó   — t         ‚)zbase ** selfr   )r   Úbases     r   Ú__rpow__zComplex.__rpow__•   r'   r   c                 ó   — t         ‚)z7Returns the Real distance from 0. Called for abs(self).r   r   s    r   Ú__abs__zComplex.__abs__š   r'   r   c                 ó   — t         ‚)z$(x+y*i).conjugate() returns (x-y*i).r   r   s    r   Ú	conjugatezComplex.conjugateŸ   r'   r   c                 ó   — t         ‚)zself == otherr   r$   s     r   Ú__eq__zComplex.__eq__¤   r'   r   N)r   r   r   r   r   r   r   r   Úpropertyr   r"   r&   r)   r+   r-   r/   r1   r3   r5   r7   r9   r<   r?   rA   rC   rE   r   r   r   r   r   9   sm  „ ñð €IàñKó ðKòð Øñ"ó ó ð"ð Øñ"ó ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"òòð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ñ"r   r   c                   óþ   — e Zd ZdZdZed„ «       Zed„ «       Zed„ «       Zed„ «       Z	edd„«       Z
d	„ Zd
„ Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zd„ Zed„ «       Zed„ «       Zd„ Zy)r   zÜ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   c                 ó   — t         ‚)zTAny Real can be converted to a native float object.

        Called for float(self).r   r   s    r   Ú	__float__zReal.__float__·   ó
   € ô
 "Ð!r   c                 ó   — t         ‚)aK  trunc(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".
        r   r   s    r   Ú	__trunc__zReal.__trunc__¾   s
   € ô "Ð!r   c                 ó   — t         ‚)z$Finds the greatest Integral <= self.r   r   s    r   Ú	__floor__zReal.__floor__Ë   r'   r   c                 ó   — t         ‚)z!Finds the least Integral >= self.r   r   s    r   Ú__ceil__zReal.__ceil__Ð   r'   r   Nc                 ó   — t         ‚)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   )r   Úndigitss     r   Ú	__round__zReal.__round__Õ   r    r   c                 ó   — | |z  | |z  fS )z™divmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r   r$   s     r   Ú
__divmod__zReal.__divmod__Þ   s   € ð ˜‘˜t e™|Ð,Ð,r   c                 ó   — || z  || z  fS )z™divmod(other, self): The pair (other // self, other % self).

        Sometimes this can be computed faster than the pair of
        operations.
        r   r$   s     r   Ú__rdivmod__zReal.__rdivmod__æ   s   € ð ˜‘˜u t™|Ð,Ð,r   c                 ó   — t         ‚)z)self // other: The floor() of self/other.r   r$   s     r   Ú__floordiv__zReal.__floordiv__î   r'   r   c                 ó   — t         ‚)z)other // self: The floor() of other/self.r   r$   s     r   Ú__rfloordiv__zReal.__rfloordiv__ó   r'   r   c                 ó   — t         ‚)zself % otherr   r$   s     r   Ú__mod__zReal.__mod__ø   r'   r   c                 ó   — t         ‚)zother % selfr   r$   s     r   Ú__rmod__zReal.__rmod__ý   r'   r   c                 ó   — t         ‚)zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.r   r$   s     r   Ú__lt__zReal.__lt__  rJ   r   c                 ó   — t         ‚)zself <= otherr   r$   s     r   Ú__le__zReal.__le__	  r'   r   c                 ó*   — t        t        | «      «      S )z(complex(self) == complex(float(self), 0))ÚcomplexÚfloatr   s    r   r   zReal.__complex__  s   € ä”u˜T“{Ó#Ð#r   c                 ó   — | ­S )z&Real numbers are their real component.r   r   s    r   r   z	Real.real  ó   € ð ˆuˆr   c                  ó   — y)z)Real numbers have no imaginary component.r   r   r   s    r   r"   z	Real.imag  ó   € ð r   c                 ó   — | ­S )zConjugate is a no-op for Reals.r   r   s    r   rC   zReal.conjugate  s	   € àˆuˆr   ©N)r   r   r   r   r   r   rI   rL   rN   rP   rS   rU   rW   rY   r[   r]   r_   ra   rc   r   rF   r   r"   rC   r   r   r   r   r   ¬   s$  „ ñð €Iàñ"ó ð"ð ñ
"ó ð
"ð ñ"ó ð"ð ñ"ó ð"ð ò"ó ð"ò-ò-ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ò
$ð ñó ðð ñó ðór   r   c                   óN   — e Zd ZdZdZeed„ «       «       Zeed„ «       «       Zd„ Z	y)r   z6.numerator and .denominator should be in lowest terms.r   c                 ó   — t         ‚rl   r   r   s    r   Ú	numeratorzRational.numerator)  r'   r   c                 ó   — t         ‚rl   r   r   s    r   ÚdenominatorzRational.denominator.  r'   r   c                 óX   — t        | j                  «      t        | j                  «      z  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.

        )Úintro   rq   r   s    r   rI   zRational.__float__4  s#   € ô �4—>‘>Ó"¤S¨×)9Ñ)9Ó%:Ñ:Ð:r   N)
r   r   r   r   r   rF   r   ro   rq   rI   r   r   r   r   r   $  sE   „ Ù@à€IàØñ"ó ó ð"ð Øñ"ó ó ð"ó;r   r   c                   ó  — e Zd ZdZdZed„ «       Zd„ Zedd„«       Zed„ «       Z	ed„ «       Z
ed	„ «       Zed
„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zd„ Zed„ «       Zed„ «       Zy)r	   zšIntegral adds methods that work on integral numbers.

    In short, these are conversion to int, pow with modulus, and the
    bit-string operations.
    r   c                 ó   — t         ‚)z	int(self)r   r   s    r   Ú__int__zIntegral.__int__H  r'   r   c                 ó   — t        | «      S )z6Called whenever an index is needed, such as in slicing)rs   r   s    r   Ú	__index__zIntegral.__index__M  s   € ä�4‹yÐr   Nc                 ó   — t         ‚)a4  self ** 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   )r   r;   Úmoduluss      r   r<   zIntegral.__pow__Q  s
   € ô "Ð!r   c                 ó   — t         ‚)zself << otherr   r$   s     r   Ú
__lshift__zIntegral.__lshift__\  r'   r   c                 ó   — t         ‚)zother << selfr   r$   s     r   Ú__rlshift__zIntegral.__rlshift__a  r'   r   c                 ó   — t         ‚)zself >> otherr   r$   s     r   Ú
__rshift__zIntegral.__rshift__f  r'   r   c                 ó   — t         ‚)zother >> selfr   r$   s     r   Ú__rrshift__zIntegral.__rrshift__k  r'   r   c                 ó   — t         ‚)zself & otherr   r$   s     r   Ú__and__zIntegral.__and__p  r'   r   c                 ó   — t         ‚)zother & selfr   r$   s     r   Ú__rand__zIntegral.__rand__u  r'   r   c                 ó   — t         ‚)zself ^ otherr   r$   s     r   Ú__xor__zIntegral.__xor__z  r'   r   c                 ó   — t         ‚)zother ^ selfr   r$   s     r   Ú__rxor__zIntegral.__rxor__  r'   r   c                 ó   — t         ‚)zself | otherr   r$   s     r   Ú__or__zIntegral.__or__„  r'   r   c                 ó   — t         ‚)zother | selfr   r$   s     r   Ú__ror__zIntegral.__ror__‰  r'   r   c                 ó   — t         ‚)z~selfr   r   s    r   Ú
__invert__zIntegral.__invert__Ž  r'   r   c                 ó*   — t        t        | «      «      S )zfloat(self) == float(int(self)))rf   rs   r   s    r   rI   zIntegral.__float__”  s   € ä”S˜“YÓÐr   c                 ó   — | ­S )z"Integers are their own numerators.r   r   s    r   ro   zIntegral.numerator˜  rh   r   c                  ó   — y)z!Integers have a denominator of 1.é   r   r   s    r   rq   zIntegral.denominator�  rj   r   rl   )r   r   r   r   r   r   rv   rx   r<   r|   r~   r€   r‚   r„   r†   rˆ   rŠ   rŒ   rŽ   r�   rI   rF   ro   rq   r   r   r   r	   r	   ?  sB  „ ñð €Iàñ"ó ð"òð ò"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ð ñ"ó ð"ò
 ð ñó ðð ñó ñr   r	   N)r   Úabcr   r   Ú__all__r   r   Úregisterre   r   rf   r   r	   rs   r   r   r   ú<module>r˜      sˆ   ðñ@÷: (â
?€ô	�wõ 	ô(n"ˆfô n"ð` × Ñ �Ô ôsˆ7ô sðj ‡�ˆeÔ ô;ˆtô ;ô6aˆxô aðF 	× Ñ �#Õ r   