home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / peak / util / extremes.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  2.1 KB  |  58 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. __all__ = [
  5.     'Min',
  6.     'Max',
  7.     'Extreme']
  8.  
  9. class Extreme(object):
  10.     
  11.     def __init__(self, cmpr, rep):
  12.         object.__init__(self)
  13.         self._cmpr = cmpr
  14.         self._rep = rep
  15.  
  16.     
  17.     def __cmp__(self, other):
  18.         if isinstance(other, self.__class__):
  19.             return cmp(self._cmpr, other._cmpr)
  20.         return self._cmpr
  21.  
  22.     
  23.     def __repr__(self):
  24.         return self._rep
  25.  
  26.     
  27.     def __lt__(self, other):
  28.         return self.__cmp__(other) < 0
  29.  
  30.     
  31.     def __le__(self, other):
  32.         return self.__cmp__(other) <= 0
  33.  
  34.     
  35.     def __gt__(self, other):
  36.         return self.__cmp__(other) > 0
  37.  
  38.     
  39.     def __eq__(self, other):
  40.         return self.__cmp__(other) == 0
  41.  
  42.     
  43.     def __ge__(self, other):
  44.         return self.__cmp__(other) >= 0
  45.  
  46.     
  47.     def __ne__(self, other):
  48.         return self.__cmp__(other) != 0
  49.  
  50.  
  51. Max = Extreme(1, 'Max')
  52. Min = Extreme(-1, 'Min')
  53.  
  54. def additional_tests():
  55.     import doctest
  56.     return doctest.DocFileSuite('README.txt', package = '__main__', optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
  57.  
  58.