Ñò
Žà"Ic           @   sí   d  Z  d d k l Z d d k l Z l Z l Z d d d d d g Z d e f d	 „  ƒ  YZ	 d e	 f d
 „  ƒ  YZ
 e
 i e ƒ d e
 f d „  ƒ  YZ e i e ƒ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e i e ƒ e i 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 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   Nonet   __hash__(    (    (    s$   /mit/python/lib/python2.6/numbers.pyR      s   c           B   s@  e  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$   /mit/python/lib/python2.6/numbers.pyt   __complex__,   s    c         C   s
   |  d j S(   s)   True if self != 0. Called for bool(self).i    (    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __nonzero__1   s    c         C   s
   t  ‚ d S(   sX   Retrieve the real component of this number.

        This should subclass Real.
        N(   t   NotImplementedError(   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   real5   s    c         C   s
   t  ‚ d S(   sX   Retrieve the real component of this number.

        This should subclass Real.
        N(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   imag=   s    c         C   s
   t  ‚ d S(   s   self + otherN(   R   (   R   t   other(    (    s$   /mit/python/lib/python2.6/numbers.pyt   __add__E   s    c         C   s
   t  ‚ d S(   s   other + selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __radd__J   s    c         C   s
   t  ‚ d S(   s   -selfN(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __neg__O   s    c         C   s
   t  ‚ d S(   s   +selfN(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __pos__T   s    c         C   s	   |  | S(   s   self - other(    (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __sub__Y   s    c         C   s	   |  | S(   s   other - self(    (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rsub__]   s    c         C   s
   t  ‚ d S(   s   self * otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __mul__a   s    c         C   s
   t  ‚ d S(   s   other * selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rmul__f   s    c         C   s
   t  ‚ d S(   sP   self / other without __future__ division

        May promote to float.
        N(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __div__k   s    c         C   s
   t  ‚ d S(   s(   other / self without __future__ divisionN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rdiv__s   s    c         C   s
   t  ‚ d S(   s`   self / other with __future__ division.

        Should promote to float when necessary.
        N(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __truediv__x   s    c         C   s
   t  ‚ d S(   s%   other / self with __future__ divisionN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/numbers.pyt   __pow__…   s    c         C   s
   t  ‚ d S(   s   base ** selfN(   R   (   R   t   base(    (    s$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/numbers.pyt   __abs__   s    c         C   s
   t  ‚ d S(   s$   (x+y*i).conjugate() returns (x-y*i).N(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt	   conjugate”   s    c         C   s
   t  ‚ d S(   s   self == otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __eq__™   s    c         C   s   |  | j S(   s   self != other(    (   R   R   (    (    s$   /mit/python/lib/python2.6/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)   (    (    (    s$   /mit/python/lib/python2.6/numbers.pyR   !   s.   				c           B   sÈ   e  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$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/numbers.pyt   __rdivmod__Ë   s    c         C   s
   t  ‚ d S(   s)   self // other: The floor() of self/other.N(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __floordiv__Ó   s    c         C   s
   t  ‚ d S(   s)   other // self: The floor() of other/self.N(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rfloordiv__Ø   s    c         C   s
   t  ‚ d S(   s   self % otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __mod__Ý   s    c         C   s
   t  ‚ d S(   s   other % selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/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$   /mit/python/lib/python2.6/numbers.pyt   __lt__ç   s    c         C   s
   t  ‚ d S(   s   self <= otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __le__î   s    c         C   s   t  t |  ƒ ƒ S(   s(   complex(self) == complex(float(self), 0)(   t   complext   float(   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR   ô   s    c         C   s   |  
S(   s&   Real numbers are their real component.(    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR   ø   s    c         C   s   d S(   s)   Real numbers have no imaginary component.i    (    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR   ý   s    c         C   s   |  
S(   s   Conjugate is a no-op for Reals.(    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR'     s    (   R	   R
   R   R   R*   R+   R,   R-   R.   R/   R0   R1   R2   R3   R   t   propertyR   R   R'   (    (    (    s$   /mit/python/lib/python2.6/numbers.pyR   ¦   s   			c           B   s5   e  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$   /mit/python/lib/python2.6/numbers.pyt	   numerator  s    c         C   s
   t  ‚ d  S(   N(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   denominator  s    c         C   s   |  i  |  i 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.

        (   R7   R8   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR*     s    (   R	   R
   R   R   R7   R8   R*   (    (    (    s$   /mit/python/lib/python2.6/numbers.pyR   	  s   c           B   s  e  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$   /mit/python/lib/python2.6/numbers.pyt   __long__#  s    c         C   s
   t  |  ƒ S(   s   index(self)(   t   long(   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt	   __index__(  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$   /mit/python/lib/python2.6/numbers.pyR#   ,  s    	c         C   s
   t  ‚ d S(   s   self << otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt
   __lshift__7  s    c         C   s
   t  ‚ d S(   s   other << selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rlshift__<  s    c         C   s
   t  ‚ d S(   s   self >> otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt
   __rshift__A  s    c         C   s
   t  ‚ d S(   s   other >> selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rrshift__F  s    c         C   s
   t  ‚ d S(   s   self & otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __and__K  s    c         C   s
   t  ‚ d S(   s   other & selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rand__P  s    c         C   s
   t  ‚ d S(   s   self ^ otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __xor__U  s    c         C   s
   t  ‚ d S(   s   other ^ selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __rxor__Z  s    c         C   s
   t  ‚ d S(   s   self | otherN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __or___  s    c         C   s
   t  ‚ d S(   s   other | selfN(   R   (   R   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt   __ror__d  s    c         C   s
   t  ‚ d S(   s   ~selfN(   R   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyt
   __invert__i  s    c         C   s   t  t |  ƒ ƒ S(   s    float(self) == float(long(self))(   R5   R:   (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR*   o  s    c         C   s   |  
S(   s"   Integers are their own numerators.(    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR7   s  s    c         C   s   d S(   s!   Integers have a denominator of 1.i   (    (   R   (    (    s$   /mit/python/lib/python2.6/numbers.pyR8   x  s    N(   R	   R
   R   R   R9   R;   R   R#   R=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   R*   R6   R7   R8   (    (    (    s$   /mit/python/lib/python2.6/numbers.pyR      s&   	
	N(   R   t
   __future__R    t   abcR   R   R   t   __all__t   objectR   R   t   registerR4   R   R5   R   R   t   intR:   (    (    (    s$   /mit/python/lib/python2.6/numbers.pyt   <module>   s   ‚`]