insndb/db: deindent classes
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 3 Jun 2023 10:25:56 +0000 (13:25 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Dec 2023 19:26:19 +0000 (19:26 +0000)
src/openpower/insndb/db.py

index ac65a31a150c9a7f1a41cc32feb90acb3869151b..c66a07e77f87734b360444dba5f030d6cc9765f0 100644 (file)
@@ -11,29 +11,32 @@ from openpower.insndb.core import (
 )
 
 
-def main():
-    class GenericVisitor(Visitor):
-        def __init__(self, **_):
-            pass
-
-    class ListVisitor(GenericVisitor):
-        @contextlib.contextmanager
-        def record(self, record):
-            print(record.name)
-            yield record
-
-    class OpcodesVisitor(GenericVisitor):
-        def __init__(self, insn, **_):
-            self.__insn = insn
-            return super().__init__()
-
-        @contextlib.contextmanager
-        def record(self, record):
-            if record.name == self.__insn:
-                for opcode in record.opcodes:
-                    print(opcode)
-            yield record
+class GenericVisitor(Visitor):
+    def __init__(self, **_):
+        pass
+
+
+class ListVisitor(GenericVisitor):
+    @contextlib.contextmanager
+    def record(self, record):
+        print(record.name)
+        yield record
+
 
+class OpcodesVisitor(GenericVisitor):
+    def __init__(self, insn, **_):
+        self.__insn = insn
+        return super().__init__()
+
+    @contextlib.contextmanager
+    def record(self, record):
+        if record.name == self.__insn:
+            for opcode in record.opcodes:
+                print(opcode)
+        yield record
+
+
+def main():
     visitors = {
         "list": ListVisitor,
         "opcodes": OpcodesVisitor,