Source code for assembl.lib.enum
from __future__ import absolute_import
from enum import Enum
# Taken from the enum34 README
[docs]class OrderedEnum(Enum):
"""An enum with comparable values"""
# As per enum34 recipe
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