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

index 7490cf670e320a0dbe2bea4286874762831bd09a..c5b586f910fb2c94a86489c58a1d731b93724f98 100644 (file)
@@ -512,44 +512,43 @@ class SVP64Record(Dataclass):
         return (_RegType(self.extra_CR.reg) is _RegType.CR_3BIT)
 
 
-class BitSel:
-    def __init__(self, value=(0, 32)):
-        if isinstance(value, str):
-            (start, end) = map(int, value.split(":"))
-        else:
-            (start, end) = value
-        if start < 0 or end < 0 or start >= end:
-            raise ValueError(value)
-
-        self.__start = start
-        self.__end = end
+class Section(Dataclass):
+    class Path(type(_pathlib.Path("."))):
+        pass
 
-        return super().__init__()
+    class BitSel:
+        def __init__(self, value=(0, 32)):
+            if isinstance(value, str):
+                (start, end) = map(int, value.split(":"))
+            else:
+                (start, end) = value
+            if start < 0 or end < 0 or start >= end:
+                raise ValueError(value)
 
-    def __len__(self):
-        return (self.__end - self.__start + 1)
+            self.__start = start
+            self.__end = end
 
-    def __repr__(self):
-        return f"[{self.__start}:{self.__end}]"
+            return super().__init__()
 
-    def __iter__(self):
-        yield from range(self.start, (self.end + 1))
+        def __len__(self):
+            return (self.__end - self.__start + 1)
 
-    def __reversed__(self):
-        return tuple(reversed(tuple(self)))
+        def __repr__(self):
+            return f"[{self.__start}:{self.__end}]"
 
-    @property
-    def start(self):
-        return self.__start
+        def __iter__(self):
+            yield from range(self.start, (self.end + 1))
 
-    @property
-    def end(self):
-        return self.__end
+        def __reversed__(self):
+            return tuple(reversed(tuple(self)))
 
+        @property
+        def start(self):
+            return self.__start
 
-class Section(Dataclass):
-    class Path(type(_pathlib.Path("."))):
-        pass
+        @property
+        def end(self):
+            return self.__end
 
     class Mode(_enum.Enum):
         INTEGER = _enum.auto()