
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \(  ã               @   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jeƒ G dd„ deƒZ	e	je
ƒ G dd„ de	ƒZG dd„ deƒZej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f ZdZdS )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   r   ú/usr/lib64/python3.6/numbers.pyr      s   )Ú	metaclassc               @   sô   e Zd ZdZf 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   aa  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 heterogenous arguments, and doesn't have special
    knowledge about them, it should fall back to the builtin complex
    type as described below.
    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)ÚNotImplementedError)r   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.
        N)r   )r   r   r   r   Úimag>   s    zComplex.imagc             C   s   t ‚dS )zself + otherN)r   )r   Úotherr   r   r   Ú__add__G   s    zComplex.__add__c             C   s   t ‚dS )zother + selfN)r   )r   r   r   r   r   Ú__radd__L   s    zComplex.__radd__c             C   s   t ‚dS )z-selfN)r   )r   r   r   r   Ú__neg__Q   s    zComplex.__neg__c             C   s   t ‚dS )z+selfN)r   )r   r   r   r   Ú__pos__V   s    zComplex.__pos__c             C   s
   | |  S )zself - otherr   )r   r   r   r   r   Ú__sub__[   s    zComplex.__sub__c             C   s
   |  | S )zother - selfr   )r   r   r   r   r   Ú__rsub___   s    zComplex.__rsub__c             C   s   t ‚dS )zself * otherN)r   )r   r   r   r   r   Ú__mul__c   s    zComplex.__mul__c             C   s   t ‚dS )zother * selfN)r   )r   r   r   r   r   Ú__rmul__h   s    zComplex.__rmul__c             C   s   t ‚dS )z5self / other: Should promote to float when necessary.N)r   )r   r   r   r   r   Ú__truediv__m   s    zComplex.__truediv__c             C   s   t ‚dS )zother / selfN)r   )r   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.N)r   )r   Úexponentr   r   r   Ú__pow__w   s    zComplex.__pow__c             C   s   t ‚dS )zbase ** selfN)r   )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).N)r   )r   r   r   r   Ú__abs__�   s    zComplex.__abs__c             C   s   t ‚dS )z$(x+y*i).conjugate() returns (x-y*i).N)r   )r   r   r   r   Ú	conjugate†   s    zComplex.conjugatec             C   s   t ‚dS )zself == otherN)r   )r   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       s.   	c               @   sÒ   e Zd ZdZf 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   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.
    c             C   s   t ‚dS )zTAny Real can be converted to a native float object.

        Called for float(self).N)r   )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".
        N)r   )r   r   r   r   Ú	__trunc__¥   s    zReal.__trunc__c             C   s   t ‚dS )z$Finds the greatest Integral <= self.N)r   )r   r   r   r   Ú	__floor__²   s    zReal.__floor__c             C   s   t ‚dS )z!Finds the least Integral >= self.N)r   )r   r   r   r   Ú__ceil__·   s    zReal.__ceil__Nc             C   s   t ‚dS )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.
        N)r   )r   Zndigitsr   r   r   Ú	__round__¼   s    zReal.__round__c             C   s   | | | | 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   r   r   r   r   Ú
__divmod__Å   s    zReal.__divmod__c             C   s   ||  ||  fS )z™divmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r   )r   r   r   r   r   Ú__rdivmod__Í   s    zReal.__rdivmod__c             C   s   t ‚dS )z)self // other: The floor() of self/other.N)r   )r   r   r   r   r   Ú__floordiv__Õ   s    zReal.__floordiv__c             C   s   t ‚dS )z)other // self: The floor() of other/self.N)r   )r   r   r   r   r   Ú__rfloordiv__Ú   s    zReal.__rfloordiv__c             C   s   t ‚dS )zself % otherN)r   )r   r   r   r   r   Ú__mod__ß   s    zReal.__mod__c             C   s   t ‚dS )zother % selfN)r   )r   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.N)r   )r   r   r   r   r   Ú__lt__é   s    zReal.__lt__c             C   s   t ‚dS )zself <= otherN)r   )r   r   r   r   r   Ú__le__ð   s    zReal.__le__c             C   s   t t| ƒƒS )z(complex(self) == complex(float(self), 0))ÚcomplexÚfloat)r   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,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r*   r   r   r(   r   r   r   r   r   “   s(   c               @   s<   e Zd ZdZf 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.c             C   s   t ‚d S )N)r   )r   r   r   r   Ú	numerator  s    zRational.numeratorc             C   s   t ‚d S )N)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f 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.c             C   s   t ‚dS )z	int(self)N)r   )r   r   r   r   Ú__int__+  s    zIntegral.__int__c             C   s   t | ƒS )z6Called whenever an index is needed, such as in slicing)Úint)r   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.
        N)r   )r   r#   Úmodulusr   r   r   r$   4  s    	zIntegral.__pow__c             C   s   t ‚dS )zself << otherN)r   )r   r   r   r   r   Ú
__lshift__?  s    zIntegral.__lshift__c             C   s   t ‚dS )zother << selfN)r   )r   r   r   r   r   Ú__rlshift__D  s    zIntegral.__rlshift__c             C   s   t ‚dS )zself >> otherN)r   )r   r   r   r   r   Ú
__rshift__I  s    zIntegral.__rshift__c             C   s   t ‚dS )zother >> selfN)r   )r   r   r   r   r   Ú__rrshift__N  s    zIntegral.__rrshift__c             C   s   t ‚dS )zself & otherN)r   )r   r   r   r   r   Ú__and__S  s    zIntegral.__and__c             C   s   t ‚dS )zother & selfN)r   )r   r   r   r   r   Ú__rand__X  s    zIntegral.__rand__c             C   s   t ‚dS )zself ^ otherN)r   )r   r   r   r   r   Ú__xor__]  s    zIntegral.__xor__c             C   s   t ‚dS )zother ^ selfN)r   )r   r   r   r   r   Ú__rxor__b  s    zIntegral.__rxor__c             C   s   t ‚dS )zself | otherN)r   )r   r   r   r   r   Ú__or__g  s    zIntegral.__or__c             C   s   t ‚dS )zother | selfN)r   )r   r   r   r   r   Ú__ror__l  s    zIntegral.__ror__c             C   s   t ‚dS )z~selfN)r   )r   r   r   r   Ú
__invert__q  s    zIntegral.__invert__c             C   s   t t| ƒƒS )zfloat(self) == float(int(self)))r9   r=   )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<   r>   r$   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   r+   r*   r:   r;   r   r   r   r   r   &  s(   
N)r   Úabcr   r   Ú__all__r   r   Úregisterr8   r   r9   r   r   r=   r   r   r   r   Ú<module>   s   p
u
_