From fa5b6d2acf2683dd970253341592a655d45b7f04 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sat, 3 Jun 2023 13:25:56 +0300 Subject: [PATCH] insndb/db: deindent classes --- src/openpower/insndb/db.py | 47 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/openpower/insndb/db.py b/src/openpower/insndb/db.py index ac65a31a..c66a07e7 100644 --- a/src/openpower/insndb/db.py +++ b/src/openpower/insndb/db.py @@ -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, -- 2.30.2