ó
è¾bc           @   sí   d  Z  d d l m Z d d l m Z m Z m Z d d d d d g Z d e f d	 „  ƒ  YZ	 d e	 f d
 „  ƒ  YZ
 e
 j e ƒ d e
 f d „  ƒ  YZ e j e ƒ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e j e ƒ e j e ƒ d S(   s~   Abstract Base Classes (ABCs) for numbers, according to PEP 3141.

TODO: Fill out more detailed documentation on the operators.iÿÿÿÿ(   t   division(   t   ABCMetat   abstractmethodt   abstractpropertyt   Numbert   Complext   Realt   Rationalt   Integralc           B   s    e  Z d  Z e Z d Z d Z RS(   sŸ   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(   t   __name__t
   __module__t   __doc__R   t   __metaclass__t	   __slots__t   Nonet   __hash__(    (    (    s   /usr/lib/python2.7/numbers.pyR      s   c           B   sF  e  Z d  Z d Z e d „  ƒ Z d „  Z e d „  ƒ Z 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 e d „  ƒ Z e d „  ƒ Z d „  Z RS(   sa  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(   s<   Return a builtin complex instance. Called for complex(self).N(    (   t   self(    (    s   /usr/lib/python2.7/numbers.pyt   __complex__/   t    c         C   s
   |  d k S(   s)   True if self != 0. Called for bool(self).i    (    (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __nonzero__4   s    c         C   s
   t  ‚ d S(   sX   Retrieve the real component of this number.

        This should subclass Real.
        N(   t   NotImplementedError(   R   (    (    s   /usr/lib/python2.7/numbers.pyt   real8   s    c         C   s
   t  ‚ d S(   s]   Retrieve the imaginary component of this number.

        This should subclass Real.
        N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   imag@   s    c         C   s
   t  ‚ d S(   s   self + otherN(   R   (   R   t   other(    (    s   /usr/lib/python2.7/numbers.pyt   __add__H   s    c         C   s
   t  ‚ d S(   s   other + selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __radd__M   s    c         C   s
   t  ‚ d S(   s   -selfN(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __neg__R   s    c         C   s
   t  ‚ d S(   s   +selfN(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __pos__W   s    c         C   s	   |  | S(   s   self - other(    (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __sub__\   s    c         C   s	   |  | S(   s   other - self(    (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rsub__`   s    c         C   s
   t  ‚ d S(   s   self * otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __mul__d   s    c         C   s
   t  ‚ d S(   s   other * selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rmul__i   s    c         C   s
   t  ‚ d S(   sP   self / other without __future__ division

        May promote to float.
        N(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __div__n   s    c         C   s
   t  ‚ d S(   s(   other / self without __future__ divisionN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rdiv__v   s    c         C   s
   t  ‚ d S(   s`   self / other with __future__ division.

        Should promote to float when necessary.
        N(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __truediv__{   s    c         C   s
   t  ‚ d S(   s%   other / self with __future__ divisionN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rtruediv__ƒ   s    c         C   s
   t  ‚ d S(   sB   self**exponent; should promote to float or complex when necessary.N(   R   (   R   t   exponent(    (    s   /usr/lib/python2.7/numbers.pyt   __pow__ˆ   s    c         C   s
   t  ‚ d S(   s   base ** selfN(   R   (   R   t   base(    (    s   /usr/lib/python2.7/numbers.pyt   __rpow__   s    c         C   s
   t  ‚ d S(   s7   Returns the Real distance from 0. Called for abs(self).N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __abs__’   s    c         C   s
   t  ‚ d S(   s$   (x+y*i).conjugate() returns (x-y*i).N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt	   conjugate—   s    c         C   s
   t  ‚ d S(   s   self == otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __eq__œ   s    c         C   s   |  | k S(   s   self != other(    (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __ne__¡   s    (    (   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   R%   R'   R(   R)   R*   R+   (    (    (    s   /usr/lib/python2.7/numbers.pyR   "   s0   				c           B   sÎ   e  Z d  Z 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 d „  Z e d „  ƒ Z e d „  ƒ Z d „  Z RS(   sÜ   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(   sT   Any Real can be converted to a native float object.

        Called for float(self).N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt	   __float__´   s    c         C   s
   t  ‚ d S(   sG  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   (    (    s   /usr/lib/python2.7/numbers.pyt	   __trunc__»   s    c         C   s   |  | |  | f S(   s™   divmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        (    (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt
   __divmod__È   s    c         C   s   | |  | |  f S(   s™   divmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        (    (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rdivmod__Ð   s    c         C   s
   t  ‚ d S(   s)   self // other: The floor() of self/other.N(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __floordiv__Ø   s    c         C   s
   t  ‚ d S(   s)   other // self: The floor() of other/self.N(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rfloordiv__Ý   s    c         C   s
   t  ‚ d S(   s   self % otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __mod__â   s    c         C   s
   t  ‚ d S(   s   other % selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rmod__ç   s    c         C   s
   t  ‚ d S(   sR   self < other

        < on Reals defines a total ordering, except perhaps for NaN.N(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __lt__ì   s    c         C   s
   t  ‚ d S(   s   self <= otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __le__ó   s    c         C   s   t  t |  ƒ ƒ S(   s(   complex(self) == complex(float(self), 0)(   t   complext   float(   R   (    (    s   /usr/lib/python2.7/numbers.pyR   ù   s    c         C   s   |  
S(   s&   Real numbers are their real component.(    (   R   (    (    s   /usr/lib/python2.7/numbers.pyR   ý   s    c         C   s   d S(   s)   Real numbers have no imaginary component.i    (    (   R   (    (    s   /usr/lib/python2.7/numbers.pyR     s    c         C   s   |  
S(   s   Conjugate is a no-op for Reals.(    (   R   (    (    s   /usr/lib/python2.7/numbers.pyR)     s    (    (   R	   R
   R   R   R   R,   R-   R.   R/   R0   R1   R2   R3   R4   R5   R   t   propertyR   R   R)   (    (    (    s   /usr/lib/python2.7/numbers.pyR   ©   s    			c           B   s;   e  Z d  Z d Z e d „  ƒ Z e d „  ƒ Z d „  Z RS(   s6   .numerator and .denominator should be in lowest terms.c         C   s
   t  ‚ d  S(   N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt	   numerator  s    c         C   s
   t  ‚ d  S(   N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   denominator  s    c         C   s   |  j  |  j S(   s  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.

        (   R9   R:   (   R   (    (    s   /usr/lib/python2.7/numbers.pyR,     s    (    (   R	   R
   R   R   R   R9   R:   R,   (    (    (    s   /usr/lib/python2.7/numbers.pyR     s
   c           B   s
  e  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 RS(   sA   Integral adds a conversion to long and the bit-string operations.c         C   s
   t  ‚ d S(   s
   long(self)N(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __long__,  s    c         C   s
   t  |  ƒ S(   s6   Called whenever an index is needed, such as in slicing(   t   long(   R   (    (    s   /usr/lib/python2.7/numbers.pyt	   __index__1  s    c         C   s
   t  ‚ d S(   s4  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$   t   modulus(    (    s   /usr/lib/python2.7/numbers.pyR%   5  s    	c         C   s
   t  ‚ d S(   s   self << otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt
   __lshift__@  s    c         C   s
   t  ‚ d S(   s   other << selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rlshift__E  s    c         C   s
   t  ‚ d S(   s   self >> otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt
   __rshift__J  s    c         C   s
   t  ‚ d S(   s   other >> selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rrshift__O  s    c         C   s
   t  ‚ d S(   s   self & otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __and__T  s    c         C   s
   t  ‚ d S(   s   other & selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rand__Y  s    c         C   s
   t  ‚ d S(   s   self ^ otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __xor__^  s    c         C   s
   t  ‚ d S(   s   other ^ selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __rxor__c  s    c         C   s
   t  ‚ d S(   s   self | otherN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __or__h  s    c         C   s
   t  ‚ d S(   s   other | selfN(   R   (   R   R   (    (    s   /usr/lib/python2.7/numbers.pyt   __ror__m  s    c         C   s
   t  ‚ d S(   s   ~selfN(   R   (   R   (    (    s   /usr/lib/python2.7/numbers.pyt
   __invert__r  s    c         C   s   t  t |  ƒ ƒ S(   s    float(self) == float(long(self))(   R7   R<   (   R   (    (    s   /usr/lib/python2.7/numbers.pyR,   x  s    c         C   s   |  
S(   s"   Integers are their own numerators.(    (   R   (    (    s   /usr/lib/python2.7/numbers.pyR9   |  s    c         C   s   d S(   s!   Integers have a denominator of 1.i   (    (   R   (    (    s   /usr/lib/python2.7/numbers.pyR:     s    (    N(   R	   R
   R   R   R   R;   R=   R   R%   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   R,   R8   R9   R:   (    (    (    s   /usr/lib/python2.7/numbers.pyR   '  s(   	
	N(   R   t
   __future__R    t   abcR   R   R   t   __all__t   objectR   R   t   registerR6   R   R7   R   R   t   intR<   (    (    (    s   /usr/lib/python2.7/numbers.pyt   <module>   s   „b_