diff options
-rw-r--r-- | windy/point_forecast.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 743d85f..54a10c1 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -19,6 +19,29 @@ def _convert_notation(unit): class _StrEnum(Enum): + def __init__(self, value): + self._index = len(self.__class__.__members__) + + def __lt__(self, other): + if self.__class__ is other.__class__: + return self._index < other._index + return NotImplemented + + def __le__(self, other): + if self.__class__ is other.__class__: + return self._index <= other._index + return NotImplemented + + def __gt__(self, other): + if self.__class__ is other.__class__: + return self._index > other._index + return NotImplemented + + def __ge__(self, other): + if self.__class__ is other.__class__: + return self._index >= other._index + return NotImplemented + def __str__(self): return self.value |