Home | History | Annotate | Download | only in packaging
      1 # This file is dual licensed under the terms of the Apache License, Version
      2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
      3 # for complete details.
      4 from __future__ import absolute_import, division, print_function
      5 
      6 
      7 class Infinity(object):
      8 
      9     def __repr__(self):
     10         return "Infinity"
     11 
     12     def __hash__(self):
     13         return hash(repr(self))
     14 
     15     def __lt__(self, other):
     16         return False
     17 
     18     def __le__(self, other):
     19         return False
     20 
     21     def __eq__(self, other):
     22         return isinstance(other, self.__class__)
     23 
     24     def __ne__(self, other):
     25         return not isinstance(other, self.__class__)
     26 
     27     def __gt__(self, other):
     28         return True
     29 
     30     def __ge__(self, other):
     31         return True
     32 
     33     def __neg__(self):
     34         return NegativeInfinity
     35 
     36 Infinity = Infinity()
     37 
     38 
     39 class NegativeInfinity(object):
     40 
     41     def __repr__(self):
     42         return "-Infinity"
     43 
     44     def __hash__(self):
     45         return hash(repr(self))
     46 
     47     def __lt__(self, other):
     48         return True
     49 
     50     def __le__(self, other):
     51         return True
     52 
     53     def __eq__(self, other):
     54         return isinstance(other, self.__class__)
     55 
     56     def __ne__(self, other):
     57         return not isinstance(other, self.__class__)
     58 
     59     def __gt__(self, other):
     60         return False
     61 
     62     def __ge__(self, other):
     63         return False
     64 
     65     def __neg__(self):
     66         return Infinity
     67 
     68 NegativeInfinity = NegativeInfinity()
     69