home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_262 / numbers.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-09-09  |  8.4 KB  |  307 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.7)
  3.  
  4. from __future__ import division
  5. from abc import ABCMeta, abstractmethod, abstractproperty
  6. __all__ = [
  7.     'Number',
  8.     'Complex',
  9.     'Real',
  10.     'Rational',
  11.     'Integral']
  12.  
  13. class Number(object):
  14.     __metaclass__ = ABCMeta
  15.     __slots__ = ()
  16.     __hash__ = None
  17.  
  18.  
  19. class Complex(Number):
  20.     __slots__ = ()
  21.     
  22.     def __complex__(self):
  23.         pass
  24.  
  25.     __complex__ = abstractmethod(__complex__)
  26.     
  27.     def __nonzero__(self):
  28.         return self != 0
  29.  
  30.     
  31.     def real(self):
  32.         raise NotImplementedError
  33.  
  34.     real = abstractproperty(real)
  35.     
  36.     def imag(self):
  37.         raise NotImplementedError
  38.  
  39.     imag = abstractproperty(imag)
  40.     
  41.     def __add__(self, other):
  42.         raise NotImplementedError
  43.  
  44.     __add__ = abstractmethod(__add__)
  45.     
  46.     def __radd__(self, other):
  47.         raise NotImplementedError
  48.  
  49.     __radd__ = abstractmethod(__radd__)
  50.     
  51.     def __neg__(self):
  52.         raise NotImplementedError
  53.  
  54.     __neg__ = abstractmethod(__neg__)
  55.     
  56.     def __pos__(self):
  57.         raise NotImplementedError
  58.  
  59.     __pos__ = abstractmethod(__pos__)
  60.     
  61.     def __sub__(self, other):
  62.         return self + -other
  63.  
  64.     
  65.     def __rsub__(self, other):
  66.         return -self + other
  67.  
  68.     
  69.     def __mul__(self, other):
  70.         raise NotImplementedError
  71.  
  72.     __mul__ = abstractmethod(__mul__)
  73.     
  74.     def __rmul__(self, other):
  75.         raise NotImplementedError
  76.  
  77.     __rmul__ = abstractmethod(__rmul__)
  78.     
  79.     def __div__(self, other):
  80.         raise NotImplementedError
  81.  
  82.     __div__ = abstractmethod(__div__)
  83.     
  84.     def __rdiv__(self, other):
  85.         raise NotImplementedError
  86.  
  87.     __rdiv__ = abstractmethod(__rdiv__)
  88.     
  89.     def __truediv__(self, other):
  90.         raise NotImplementedError
  91.  
  92.     __truediv__ = abstractmethod(__truediv__)
  93.     
  94.     def __rtruediv__(self, other):
  95.         raise NotImplementedError
  96.  
  97.     __rtruediv__ = abstractmethod(__rtruediv__)
  98.     
  99.     def __pow__(self, exponent):
  100.         raise NotImplementedError
  101.  
  102.     __pow__ = abstractmethod(__pow__)
  103.     
  104.     def __rpow__(self, base):
  105.         raise NotImplementedError
  106.  
  107.     __rpow__ = abstractmethod(__rpow__)
  108.     
  109.     def __abs__(self):
  110.         raise NotImplementedError
  111.  
  112.     __abs__ = abstractmethod(__abs__)
  113.     
  114.     def conjugate(self):
  115.         raise NotImplementedError
  116.  
  117.     conjugate = abstractmethod(conjugate)
  118.     
  119.     def __eq__(self, other):
  120.         raise NotImplementedError
  121.  
  122.     __eq__ = abstractmethod(__eq__)
  123.     
  124.     def __ne__(self, other):
  125.         return not (self == other)
  126.  
  127.  
  128. Complex.register(complex)
  129.  
  130. class Real(Complex):
  131.     __slots__ = ()
  132.     
  133.     def __float__(self):
  134.         raise NotImplementedError
  135.  
  136.     __float__ = abstractmethod(__float__)
  137.     
  138.     def __trunc__(self):
  139.         raise NotImplementedError
  140.  
  141.     __trunc__ = abstractmethod(__trunc__)
  142.     
  143.     def __divmod__(self, other):
  144.         return (self // other, self % other)
  145.  
  146.     
  147.     def __rdivmod__(self, other):
  148.         return (other // self, other % self)
  149.  
  150.     
  151.     def __floordiv__(self, other):
  152.         raise NotImplementedError
  153.  
  154.     __floordiv__ = abstractmethod(__floordiv__)
  155.     
  156.     def __rfloordiv__(self, other):
  157.         raise NotImplementedError
  158.  
  159.     __rfloordiv__ = abstractmethod(__rfloordiv__)
  160.     
  161.     def __mod__(self, other):
  162.         raise NotImplementedError
  163.  
  164.     __mod__ = abstractmethod(__mod__)
  165.     
  166.     def __rmod__(self, other):
  167.         raise NotImplementedError
  168.  
  169.     __rmod__ = abstractmethod(__rmod__)
  170.     
  171.     def __lt__(self, other):
  172.         raise NotImplementedError
  173.  
  174.     __lt__ = abstractmethod(__lt__)
  175.     
  176.     def __le__(self, other):
  177.         raise NotImplementedError
  178.  
  179.     __le__ = abstractmethod(__le__)
  180.     
  181.     def __complex__(self):
  182.         return complex(float(self))
  183.  
  184.     
  185.     def real(self):
  186.         return +self
  187.  
  188.     real = property(real)
  189.     
  190.     def imag(self):
  191.         return 0
  192.  
  193.     imag = property(imag)
  194.     
  195.     def conjugate(self):
  196.         return +self
  197.  
  198.  
  199. Real.register(float)
  200.  
  201. class Rational(Real):
  202.     __slots__ = ()
  203.     
  204.     def numerator(self):
  205.         raise NotImplementedError
  206.  
  207.     numerator = abstractproperty(numerator)
  208.     
  209.     def denominator(self):
  210.         raise NotImplementedError
  211.  
  212.     denominator = abstractproperty(denominator)
  213.     
  214.     def __float__(self):
  215.         return self.numerator / self.denominator
  216.  
  217.  
  218.  
  219. class Integral(Rational):
  220.     __slots__ = ()
  221.     
  222.     def __long__(self):
  223.         raise NotImplementedError
  224.  
  225.     __long__ = abstractmethod(__long__)
  226.     
  227.     def __index__(self):
  228.         return long(self)
  229.  
  230.     
  231.     def __pow__(self, exponent, modulus = None):
  232.         raise NotImplementedError
  233.  
  234.     __pow__ = abstractmethod(__pow__)
  235.     
  236.     def __lshift__(self, other):
  237.         raise NotImplementedError
  238.  
  239.     __lshift__ = abstractmethod(__lshift__)
  240.     
  241.     def __rlshift__(self, other):
  242.         raise NotImplementedError
  243.  
  244.     __rlshift__ = abstractmethod(__rlshift__)
  245.     
  246.     def __rshift__(self, other):
  247.         raise NotImplementedError
  248.  
  249.     __rshift__ = abstractmethod(__rshift__)
  250.     
  251.     def __rrshift__(self, other):
  252.         raise NotImplementedError
  253.  
  254.     __rrshift__ = abstractmethod(__rrshift__)
  255.     
  256.     def __and__(self, other):
  257.         raise NotImplementedError
  258.  
  259.     __and__ = abstractmethod(__and__)
  260.     
  261.     def __rand__(self, other):
  262.         raise NotImplementedError
  263.  
  264.     __rand__ = abstractmethod(__rand__)
  265.     
  266.     def __xor__(self, other):
  267.         raise NotImplementedError
  268.  
  269.     __xor__ = abstractmethod(__xor__)
  270.     
  271.     def __rxor__(self, other):
  272.         raise NotImplementedError
  273.  
  274.     __rxor__ = abstractmethod(__rxor__)
  275.     
  276.     def __or__(self, other):
  277.         raise NotImplementedError
  278.  
  279.     __or__ = abstractmethod(__or__)
  280.     
  281.     def __ror__(self, other):
  282.         raise NotImplementedError
  283.  
  284.     __ror__ = abstractmethod(__ror__)
  285.     
  286.     def __invert__(self):
  287.         raise NotImplementedError
  288.  
  289.     __invert__ = abstractmethod(__invert__)
  290.     
  291.     def __float__(self):
  292.         return float(long(self))
  293.  
  294.     
  295.     def numerator(self):
  296.         return +self
  297.  
  298.     numerator = property(numerator)
  299.     
  300.     def denominator(self):
  301.         return 1
  302.  
  303.     denominator = property(denominator)
  304.  
  305. Integral.register(int)
  306. Integral.register(long)
  307.