From 24bc06110c26159bd1b7369ddc1c761e17b537ca Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 22 Jun 2023 22:24:40 +0300 Subject: [PATCH] insndb/core: hide section priority type --- src/openpower/insndb/core.py | 45 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) 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 -- 2.30.2