diff mbox series

[3/8] python/qapi: add pylint pragmas

Message ID 20240820002318.1380276-4-jsnow@redhat.com (mailing list archive)
State New
Headers show
Series move qapi under python/qemu/ | expand

Commit Message

John Snow Aug. 20, 2024, 12:23 a.m. UTC
We are preparing to move the QAPI generator code into
qemu.git/python/qemu/qapi.

The qemu.git/python pylint configuration is stricter than the current
qapi generator configuration. These additional pragmas bridge the gap
without requiring us to loosen the requirements in the python directory.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/expr.py       | 1 +
 scripts/qapi/introspect.py | 1 +
 scripts/qapi/parser.py     | 4 ++++
 scripts/qapi/visit.py      | 1 +
 4 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index cae0a083591..f60e580dd36 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -604,6 +604,7 @@  def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
     :raise QAPISemError: When any expression fails validation.
     :return: The same list of expressions (now modified).
     """
+    # pylint: disable=too-many-branches
     for expr in exprs:
         info = expr.info
         doc = expr.doc
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index ac14b20f308..9d499f90b7c 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -106,6 +106,7 @@  def _tree_to_qlit(obj: JSONValue,
     :param dict_value: True when the value being processed belongs to a
                        dict key; which suppresses the output indent.
     """
+    # pylint: disable=too-many-branches
 
     def indent(level: int) -> str:
         return level * 4 * ' '
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 9a42b119131..9bb039fe8d3 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -118,6 +118,8 @@  def _parse(self) -> None:
 
         :return: None.  Results are stored in ``.exprs`` and ``.docs``.
         """
+        # pylint: disable=too-many-branches
+
         cur_doc = None
 
         # May raise OSError; allow the caller to handle it.
@@ -290,6 +292,7 @@  def accept(self, skip_comment: bool = True) -> None:
 
             ``.tok`` and ``.val`` will both be None at EOF.
         """
+        # pylint: disable=too-many-branches
         while True:
             self.tok = self.src[self.cursor]
             self.pos = self.cursor
@@ -478,6 +481,7 @@  def get_doc_paragraph(self, doc: 'QAPIDoc') -> Optional[str]:
             doc.append_line(line)
 
     def get_doc(self) -> 'QAPIDoc':
+        # pylint: disable=too-many-statements,too-many-branches
         if self.val != '##':
             raise QAPIParseError(
                 self, "junk after '##' at start of documentation comment")
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 12f92e429f6..20ce6be9978 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -65,6 +65,7 @@  def gen_visit_object_members(name: str,
                              base: Optional[QAPISchemaObjectType],
                              members: List[QAPISchemaObjectTypeMember],
                              branches: Optional[QAPISchemaBranches]) -> str:
+    # pylint: disable=too-many-branches
     ret = mcgen('''
 
 bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)