]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qapi/schema: add __repr__ to QAPIDoc.Section
authorJohn Snow <jsnow@redhat.com>
Tue, 11 Mar 2025 03:42:32 +0000 (23:42 -0400)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 11 Mar 2025 09:10:57 +0000 (10:10 +0100)
Makes debugging far more pleasant when you can just print(section) and
get something reasonable to display.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-35-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/parser.py

index 94d5322f8af3946af52c4ea91fe4fee8b688edcf..11c11bb09e5e61345ac7290da6b1e9ebc7191ba4 100644 (file)
@@ -668,6 +668,9 @@ class QAPIDoc:
             # section text without tag
             self.text = ''
 
+        def __repr__(self) -> str:
+            return f"<QAPIDoc.Section kind={self.kind!r} text={self.text!r}>"
+
         def append_line(self, line: str) -> None:
             self.text += line + '\n'