Your IP : 3.129.216.248


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/numbers.cpython-35.pyc



��Yf(�@s�dZddlmZmZdddddgZGdd�dd	e�ZGd
d�de�Zeje�Gdd�de�Z	e	je
�Gdd�de	�ZGd
d�de�Zeje
�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@s"eZdZdZfZdZdS)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__�rr�,/opt/alt/python35/lib64/python3.5/numbers.pyrs�	metaclassc@sleZdZdZfZedd��Zdd�Zeedd���Z	eedd	���Z
ed
d��Zedd
��Zedd��Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd(S))raaComplex 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.
    cCsdS)z<Return a builtin complex instance. Called for complex(self).Nr)�selfrrr�__complex__-szComplex.__complex__cCs
|dkS)z)True if self != 0. Called for bool(self).rr)rrrr�__bool__1szComplex.__bool__cCs
t�dS)zXRetrieve the real component of this number.

        This should subclass Real.
        N)�NotImplementedError)rrrr�real5szComplex.realcCs
t�dS)z]Retrieve the imaginary component of this number.

        This should subclass Real.
        N)r)rrrr�imag>szComplex.imagcCs
t�dS)zself + otherN)r)r�otherrrr�__add__GszComplex.__add__cCs
t�dS)zother + selfN)r)rrrrr�__radd__LszComplex.__radd__cCs
t�dS)z-selfN)r)rrrr�__neg__QszComplex.__neg__cCs
t�dS)z+selfN)r)rrrr�__pos__VszComplex.__pos__cCs	||S)zself - otherr)rrrrr�__sub__[szComplex.__sub__cCs	||S)zother - selfr)rrrrr�__rsub___szComplex.__rsub__cCs
t�dS)zself * otherN)r)rrrrr�__mul__cszComplex.__mul__cCs
t�dS)zother * selfN)r)rrrrr�__rmul__hszComplex.__rmul__cCs
t�dS)z5self / other: Should promote to float when necessary.N)r)rrrrr�__truediv__mszComplex.__truediv__cCs
t�dS)zother / selfN)r)rrrrr�__rtruediv__rszComplex.__rtruediv__cCs
t�dS)zBself**exponent; should promote to float or complex when necessary.N)r)r�exponentrrr�__pow__wszComplex.__pow__cCs
t�dS)zbase ** selfN)r)r�baserrr�__rpow__|szComplex.__rpow__cCs
t�dS)z7Returns the Real distance from 0. Called for abs(self).N)r)rrrr�__abs__�szComplex.__abs__cCs
t�dS)z$(x+y*i).conjugate() returns (x-y*i).N)r)rrrr�	conjugate�szComplex.conjugatecCs
t�dS)z
self == otherN)r)rrrrr�__eq__�szComplex.__eq__N)r	r
rrr
rrr�propertyrrrrrrrrrr r!r"r$r&r'r(r)rrrrr s.	c@s9eZdZdZfZedd��Zedd��Zedd��Zedd	��Z	ed
dd��Z
d
d�Zdd�Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zedd ��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.
    cCs
t�dS)zTAny Real can be converted to a native float object.

        Called for float(self).N)r)rrrr�	__float__�szReal.__float__cCs
t�dS)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".
        N)r)rrrr�	__trunc__�szReal.__trunc__cCs
t�dS)z$Finds the greatest Integral <= self.N)r)rrrr�	__floor__�szReal.__floor__cCs
t�dS)z!Finds the least Integral >= self.N)r)rrrr�__ceil__�sz
Real.__ceil__NcCs
t�dS)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)rZndigitsrrr�	__round__�szReal.__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)rrrrr�
__divmod__�szReal.__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)rrrrr�__rdivmod__�szReal.__rdivmod__cCs
t�dS)z)self // other: The floor() of self/other.N)r)rrrrr�__floordiv__�szReal.__floordiv__cCs
t�dS)z)other // self: The floor() of other/self.N)r)rrrrr�
__rfloordiv__�szReal.__rfloordiv__cCs
t�dS)zself % otherN)r)rrrrr�__mod__�szReal.__mod__cCs
t�dS)zother % selfN)r)rrrrr�__rmod__�sz
Real.__rmod__cCs
t�dS)zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.N)r)rrrrr�__lt__�szReal.__lt__cCs
t�dS)z
self <= otherN)r)rrrrr�__le__�szReal.__le__cCstt|��S)z(complex(self) == complex(float(self), 0))�complex�float)rrrrr�szReal.__complex__cCs|
S)z&Real numbers are their real component.r)rrrrr�sz	Real.realcCsdS)z)Real numbers have no imaginary component.rr)rrrrr�sz	Real.imagcCs|
S)zConjugate is a no-op for Reals.r)rrrrr(szReal.conjugate)r	r
rrr
rr+r,r-r.r/r0r1r2r3r4r5r6r7rr*rrr(rrrrr�s(
c@sXeZdZdZfZeedd���Zeedd���Zdd�Z	dS)	rz6.numerator and .denominator should be in lowest terms.cCs
t�dS)N)r)rrrr�	numeratorszRational.numeratorcCs
t�dS)N)r)rrrr�denominatorszRational.denominatorcCs|j|jS)afloat(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;)rrrrr+szRational.__float__N)
r	r
rrr
r*rr:r;r+rrrrrsc@sEeZdZdZfZedd��Zdd�Zeddd��Zed	d
��Z	edd��Z
ed
d��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd �Zed!d"��Zed#d$��ZdS)%rz@Integral adds a conversion to int and the bit-string operations.cCs
t�dS)z	int(self)N)r)rrrr�__int__+szIntegral.__int__cCs
t|�S)z6Called whenever an index is needed, such as in slicing)�int)rrrr�	__index__0szIntegral.__index__NcCs
t�dS)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.
        N)r)rr#�modulusrrrr$4s	zIntegral.__pow__cCs
t�dS)z
self << otherN)r)rrrrr�
__lshift__?szIntegral.__lshift__cCs
t�dS)z
other << selfN)r)rrrrr�__rlshift__DszIntegral.__rlshift__cCs
t�dS)z
self >> otherN)r)rrrrr�
__rshift__IszIntegral.__rshift__cCs
t�dS)z
other >> selfN)r)rrrrr�__rrshift__NszIntegral.__rrshift__cCs
t�dS)zself & otherN)r)rrrrr�__and__SszIntegral.__and__cCs
t�dS)zother & selfN)r)rrrrr�__rand__XszIntegral.__rand__cCs
t�dS)zself ^ otherN)r)rrrrr�__xor__]szIntegral.__xor__cCs
t�dS)zother ^ selfN)r)rrrrr�__rxor__bszIntegral.__rxor__cCs
t�dS)zself | otherN)r)rrrrr�__or__gszIntegral.__or__cCs
t�dS)zother | selfN)r)rrrrr�__ror__lszIntegral.__ror__cCs
t�dS)z~selfN)r)rrrr�
__invert__qszIntegral.__invert__cCstt|��S)zfloat(self) == float(int(self)))r9r=)rrrrr+wszIntegral.__float__cCs|
S)z"Integers are their own numerators.r)rrrrr:{szIntegral.numeratorcCsdS)z!Integers have a denominator of 1.�r)rrrrr;�szIntegral.denominator)r	r
rrr
rr<r>r$r@rArBrCrDrErFrGrHrIrJr+r*r:r;rrrrr&s(
N)r�abcrr�__all__rr�registerr8rr9rrr=rrrr�<module>sp
u
_

?>