From: Dmitry Selyutin Date: Thu, 22 Jun 2023 19:24:40 +0000 (+0300) Subject: insndb/core: hide section priority type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8879ac7e58ba680f75e477541eb2b36f7b6f3dc6;p=openpower-isa.git insndb/core: hide section priority type --- diff --git a/src/openpower/insndb/core.py b/src/openpower/insndb/core.py index 6dd4c336..61abc4fd 100644 --- a/src/openpower/insndb/core.py +++ b/src/openpower/insndb/core.py @@ -83,29 +83,6 @@ class Style(_enum.Enum): return (self.value < other.value) -@_functools.total_ordering -class Priority(_enum.Enum): - LOW = -1 - NORMAL = 0 - HIGH = +1 - - @classmethod - def _missing_(cls, value): - if isinstance(value, str): - value = value.upper() - try: - return cls[value] - except ValueError: - return super()._missing_(value) - - def __lt__(self, other): - if not isinstance(other, self.__class__): - return NotImplemented - - # NOTE: the order is inversed, LOW < NORMAL < HIGH - return (self.value > other.value) - - def dataclass(cls, record, keymap=None, typemap=None): if keymap is None: keymap = {} @@ -591,6 +568,28 @@ class Section(Dataclass): class Opcode(IntegerOpcode): pass + @_functools.total_ordering + class Priority(_enum.Enum): + LOW = -1 + NORMAL = 0 + HIGH = +1 + + @classmethod + def _missing_(cls, value): + if isinstance(value, str): + value = value.upper() + try: + return cls[value] + except ValueError: + return super()._missing_(value) + + def __lt__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + + # NOTE: the order is inversed, LOW < NORMAL < HIGH + return (self.value > other.value) + csv: Path bitsel: BitSel suffix: Suffix