U
    ad(                     @   s   d Z ddlmZmZ dddddgZG dd ded	ZG d
d deZee G dd deZ	e	e
 G dd de	ZG dd deZee dS )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                   @   s   e Zd ZdZdZdZdS )r   zAll 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	   /usr/lib/python3.8/numbers.pyr      s   )	metaclassc                   @   s   e Zd ZdZdZedd Zdd Zeedd Z	eed	d
 Z
edd Zedd Zedd Zedd Zdd Zdd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zed'd( Zd)S )*r   ab  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                 C   s   dS )z<Return a builtin complex instance. Called for complex(self).Nr	   selfr	   r	   r   __complex__-   s    zComplex.__complex__c                 C   s   | dkS )z)True if self != 0. Called for bool(self).r   r	   r   r	   r	   r   __bool__1   s    zComplex.__bool__c                 C   s   t dS )zXRetrieve the real component of this number.

        This should subclass Real.
        NNotImplementedErrorr   r	   r	   r   real5   s    zComplex.realc                 C   s   t dS )z]Retrieve the imaginary component of this number.

        This should subclass Real.
        Nr   r   r	   r	   r   imag>   s    zComplex.imagc                 C   s   t dS )zself + otherNr   r   otherr	   r	   r   __add__G   s    zComplex.__add__c                 C   s   t dS )zother + selfNr   r   r	   r	   r   __radd__L   s    zComplex.__radd__c                 C   s   t dS )z-selfNr   r   r	   r	   r   __neg__Q   s    zComplex.__neg__c                 C   s   t dS )z+selfNr   r   r	   r	   r   __pos__V   s    zComplex.__pos__c                 C   s
   | |  S )zself - otherr	   r   r	   r	   r   __sub__[   s    zComplex.__sub__c                 C   s
   |  | S )zother - selfr	   r   r	   r	   r   __rsub___   s    zComplex.__rsub__c                 C   s   t dS )zself * otherNr   r   r	   r	   r   __mul__c   s    zComplex.__mul__c                 C   s   t dS )zother * selfNr   r   r	   r	   r   __rmul__h   s    zComplex.__rmul__c                 C   s   t dS )z5self / other: Should promote to float when necessary.Nr   r   r	   r	   r   __truediv__m   s    zComplex.__truediv__c                 C   s   t dS )zother / selfNr   r   r	   r	   r   __rtruediv__r   s    zComplex.__rtruediv__c                 C   s   t dS )zBself**exponent; should promote to float or complex when necessary.Nr   )r   exponentr	   r	   r   __pow__w   s    zComplex.__pow__c                 C   s   t dS )zbase ** selfNr   )r   baser	   r	   r   __rpow__|   s    zComplex.__rpow__c                 C   s   t dS )z7Returns the Real distance from 0. Called for abs(self).Nr   r   r	   r	   r   __abs__   s    zComplex.__abs__c                 C   s   t dS )z$(x+y*i).conjugate() returns (x-y*i).Nr   r   r	   r	   r   	conjugate   s    zComplex.conjugatec                 C   s   t dS )zself == otherNr   r   r	   r	   r   __eq__   s    zComplex.__eq__N)r
   r   r   r   r   r   r   r   propertyr   r   r   r   r   r   r    r!   r"   r#   r$   r%   r'   r)   r*   r+   r,   r	   r	   r	   r   r       sN   













c                   @   s   e Zd ZdZdZedd Zedd Zedd Zed	d
 Z	ed&ddZ
dd Zdd Zedd Zedd Zedd Zedd Zedd Zedd Zdd Zed d! Zed"d# Zd$d% ZdS )'r   zTo 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                 C   s   t dS )zTAny Real can be converted to a native float object.

        Called for float(self).Nr   r   r	   r	   r   	__float__   s    zReal.__float__c                 C   s   t dS )aG  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".
        Nr   r   r	   r	   r   	__trunc__   s    zReal.__trunc__c                 C   s   t dS )z$Finds the greatest Integral <= self.Nr   r   r	   r	   r   	__floor__   s    zReal.__floor__c                 C   s   t dS )z!Finds the least Integral >= self.Nr   r   r	   r	   r   __ceil__   s    zReal.__ceil__Nc                 C   s   t dS )zRounds 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.
        Nr   )r   Zndigitsr	   r	   r   	__round__   s    zReal.__round__c                 C   s   | | | | fS )zdivmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r	   r   r	   r	   r   
__divmod__   s    zReal.__divmod__c                 C   s   ||  ||  fS )zdivmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r	   r   r	   r	   r   __rdivmod__   s    zReal.__rdivmod__c                 C   s   t dS )z)self // other: The floor() of self/other.Nr   r   r	   r	   r   __floordiv__   s    zReal.__floordiv__c                 C   s   t dS )z)other // self: The floor() of other/self.Nr   r   r	   r	   r   __rfloordiv__   s    zReal.__rfloordiv__c                 C   s   t dS )zself % otherNr   r   r	   r	   r   __mod__   s    zReal.__mod__c                 C   s   t dS )zother % selfNr   r   r	   r	   r   __rmod__   s    zReal.__rmod__c                 C   s   t dS )zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.Nr   r   r	   r	   r   __lt__   s    zReal.__lt__c                 C   s   t dS )zself <= otherNr   r   r	   r	   r   __le__   s    zReal.__le__c                 C   s   t t| S )z(complex(self) == complex(float(self), 0))complexfloatr   r	   r	   r   r      s    zReal.__complex__c                 C   s   | 
 S )z&Real numbers are their real component.r	   r   r	   r	   r   r      s    z	Real.realc                 C   s   dS )z)Real numbers have no imaginary component.r   r	   r   r	   r	   r   r      s    z	Real.imagc                 C   s   | 
 S )zConjugate is a no-op for Reals.r	   r   r	   r	   r   r+     s    zReal.conjugate)N)r
   r   r   r   r   r   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r   r-   r   r   r+   r	   r	   r	   r   r      s@   











c                   @   s<   e Zd ZdZdZeedd Zeedd Zdd Z	d	S )
r   z6.numerator and .denominator should be in lowest terms.r	   c                 C   s   t d S Nr   r   r	   r	   r   	numerator  s    zRational.numeratorc                 C   s   t d S r=   r   r   r	   r	   r   denominator  s    zRational.denominatorc                 C   s   | j | 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.

        )r>   r?   r   r	   r	   r   r.     s    zRational.__float__N)
r
   r   r   r   r   r-   r   r>   r?   r.   r	   r	   r	   r   r     s   c                   @   s   e Zd ZdZdZedd Zdd Zed&dd	Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zd d! Zed"d# Zed$d% ZdS )'r   z@Integral adds a conversion to int and the bit-string operations.r	   c                 C   s   t dS )z	int(self)Nr   r   r	   r	   r   __int__+  s    zIntegral.__int__c                 C   s   t | S )z6Called whenever an index is needed, such as in slicing)intr   r	   r	   r   	__index__0  s    zIntegral.__index__Nc                 C   s   t dS )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.
        Nr   )r   r&   modulusr	   r	   r   r'   4  s    	zIntegral.__pow__c                 C   s   t dS )zself << otherNr   r   r	   r	   r   
__lshift__?  s    zIntegral.__lshift__c                 C   s   t dS )zother << selfNr   r   r	   r	   r   __rlshift__D  s    zIntegral.__rlshift__c                 C   s   t dS )zself >> otherNr   r   r	   r	   r   
__rshift__I  s    zIntegral.__rshift__c                 C   s   t dS )zother >> selfNr   r   r	   r	   r   __rrshift__N  s    zIntegral.__rrshift__c                 C   s   t dS )zself & otherNr   r   r	   r	   r   __and__S  s    zIntegral.__and__c                 C   s   t dS )zother & selfNr   r   r	   r	   r   __rand__X  s    zIntegral.__rand__c                 C   s   t dS )zself ^ otherNr   r   r	   r	   r   __xor__]  s    zIntegral.__xor__c                 C   s   t dS )zother ^ selfNr   r   r	   r	   r   __rxor__b  s    zIntegral.__rxor__c                 C   s   t dS )zself | otherNr   r   r	   r	   r   __or__g  s    zIntegral.__or__c                 C   s   t dS )zother | selfNr   r   r	   r	   r   __ror__l  s    zIntegral.__ror__c                 C   s   t dS )z~selfNr   r   r	   r	   r   
__invert__q  s    zIntegral.__invert__c                 C   s   t t| S )zfloat(self) == float(int(self)))r<   rA   r   r	   r	   r   r.   w  s    zIntegral.__float__c                 C   s   | 
 S )z"Integers are their own numerators.r	   r   r	   r	   r   r>   {  s    zIntegral.numeratorc                 C   s   dS )z!Integers have a denominator of 1.   r	   r   r	   r	   r   r?     s    zIntegral.denominator)N)r
   r   r   r   r   r   r@   rB   r'   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   r.   r-   r>   r?   r	   r	   r	   r   r   &  sD   













N)r   abcr   r   __all__r   r   registerr;   r   r<   r   r   rA   r	   r	   r	   r   <module>   s   p
u
_