From: Dmitry Selyutin Date: Sat, 3 Jun 2023 10:25:56 +0000 (+0300) Subject: insndb/db: deindent classes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa5b6d2acf2683dd970253341592a655d45b7f04;p=openpower-isa.git insndb/db: deindent classes --- 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,