insndb/core: hide section priority type
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 22 Jun 2023 19:24:40 +0000 (22:24 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 23 Jun 2023 07:40:45 +0000 (10:40 +0300)
src/openpower/insndb/core.py

index 6dd4c336652975e96ee5a2ef329ea4026dd58fc1..61abc4fd0b7c9ba6e9b8204b6498adec57fa2a3c 100644 (file)
@@ -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