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