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 5 6class InfinityType: 7 def __repr__(self) -> str: 8 return "Infinity" 9 10 def __hash__(self) -> int: 11 return hash(repr(self)) 12 13 def __lt__(self, other: object) -> bool: 14 return False 15 16 def __le__(self, other: object) -> bool: 17 return False 18 19 def __eq__(self, other: object) -> bool: 20 return isinstance(other, self.__class__) 21 22 def __gt__(self, other: object) -> bool: 23 return True 24 25 def __ge__(self, other: object) -> bool: 26 return True 27 28 def __neg__(self: object) -> "NegativeInfinityType": 29 return NegativeInfinity 30 31 32Infinity = InfinityType() 33 34 35class NegativeInfinityType: 36 def __repr__(self) -> str: 37 return "-Infinity" 38 39 def __hash__(self) -> int: 40 return hash(repr(self)) 41 42 def __lt__(self, other: object) -> bool: 43 return True 44 45 def __le__(self, other: object) -> bool: 46 return True 47 48 def __eq__(self, other: object) -> bool: 49 return isinstance(other, self.__class__) 50 51 def __gt__(self, other: object) -> bool: 52 return False 53 54 def __ge__(self, other: object) -> bool: 55 return False 56 57 def __neg__(self: object) -> InfinityType: 58 return Infinity 59 60 61NegativeInfinity = NegativeInfinityType() 62