You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
650 B
24 lines
650 B
3 years ago
|
from enum import Enum
|
||
|
|
||
|
|
||
|
class OrderedEnum(Enum):
|
||
|
def __ge__(self, other):
|
||
|
if self.__class__ is other.__class__:
|
||
|
return self.value >= other.value
|
||
|
return NotImplemented
|
||
|
|
||
|
def __gt__(self, other):
|
||
|
if self.__class__ is other.__class__:
|
||
|
return self.value > other.value
|
||
|
return NotImplemented
|
||
|
|
||
|
def __le__(self, other):
|
||
|
if self.__class__ is other.__class__:
|
||
|
return self.value <= other.value
|
||
|
return NotImplemented
|
||
|
|
||
|
def __lt__(self, other):
|
||
|
if self.__class__ is other.__class__:
|
||
|
return self.value < other.value
|
||
|
return NotImplemented
|