From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812856; cv=none; d=zohomail.com; s=zohoarc; b=em21AE0fDrpz/KBfps6mUBHeQg/Dzwut+tE3j707rU8mHh0v9UVD/KYRV4LxF0xSwbpnyUcRNPAPQbrmtQGjeeJ8gIztc/V5pThSMDgBVLh+gtCHII/X5pHKBERoApLrq2+DRJOA7KKiaHuICEzM5MYyWxhJ3Fi2dt+gEeVKHDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E9CQ9nBkJ2UkE7IhT+YkLiabVczHd9VF1Famx+6BpsA=; b=RCw2qduSd0n94klmFvWRJsLE9tbVyPsoDNRkmcRxFGDWO00EENRX8zzoIueb8C1kvp0ptRD8ZUWwMhIs6aKJB0293q8G7nJOO0xGbSUG5z+aSlgIxD4gkbDAyseYSWbmzTaMNF8y6TtEwiLJVluuyUvm5OzHPthllofrPNaXBrs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812856102886.3152755748777; Tue, 22 Sep 2020 15:14:16 -0700 (PDT) Received: from localhost ([::1]:44800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqYA-0000BN-RM for importer@patchew.org; Tue, 22 Sep 2020 18:14:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpj7-0003I6-PO for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpj5-000752-QR for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-TQ_1-ZiZO5eEGPEP9iCcJQ-1; Tue, 22 Sep 2020 17:21:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E7C4C801AB3; Tue, 22 Sep 2020 21:21:20 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23FDE5DE50; Tue, 22 Sep 2020 21:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E9CQ9nBkJ2UkE7IhT+YkLiabVczHd9VF1Famx+6BpsA=; b=DzoeUU85Zy0IkVrzkboV/wKDralGEFppbHpFmmS0btxihMYCv9vTP5sNYY9LTZ67R+981g 7kfpggZSQui8+TGgJz5HHNTNBx+YwD7lf9AUk5z1SAv/wt29lQYn9SM6tKrOub2eDGKcGP ESFR2+5+6bVRLNt0AWUXfywCxBCjSWg= X-MC-Unique: TQ_1-ZiZO5eEGPEP9iCcJQ-1 From: John Snow To: Markus Armbruster Subject: [PATCH 1/6] qapi/error.py: refactor error classes Date: Tue, 22 Sep 2020 17:21:10 -0400 Message-Id: <20200922212115.4084301-2-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Create a ubiquitous, context-free base error class that all exceptions in the qapi package should inherit from. Move the QAPISourceInfo relevant fields up into QAPIErrorLocation; making sure the order of arguments is consistent between QAPIErrorLocation and QAPISemError. based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- The order of arguments for QAPIParseError is inconsistent, but handled explicitly in the __init__ method; this will be addressed in forthcoming patches, but it works correctly here. Signed-off-by: John Snow --- scripts/qapi/error.py | 35 +++++++++++++++++++++++------------ scripts/qapi/main.py | 2 +- scripts/qapi/schema.py | 4 ++-- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/scripts/qapi/error.py b/scripts/qapi/error.py index ae60d9e2fe..47f266f33d 100644 --- a/scripts/qapi/error.py +++ b/scripts/qapi/error.py @@ -11,23 +11,35 @@ # This work is licensed under the terms of the GNU GPL, version 2. # See the COPYING file in the top-level directory. =20 +from typing import Optional + +from .source import QAPISourceInfo + =20 class QAPIError(Exception): - def __init__(self, info, col, msg): - Exception.__init__(self) + """Base class for all exceptions from the QAPI module.""" + + +class QAPISourceError(QAPIError): + """Error class for all exceptions identifying a source location.""" + def __init__(self, + info: QAPISourceInfo, + msg: str, + col: Optional[int] =3D None): + super().__init__() self.info =3D info - self.col =3D col self.msg =3D msg + self.col =3D col =20 - def __str__(self): + def __str__(self) -> str: loc =3D str(self.info) if self.col is not None: - assert self.info.line is not None - loc +=3D ':%s' % self.col - return loc + ': ' + self.msg + loc +=3D f":{self.col}" + return f"{loc}: {self.msg}" =20 =20 -class QAPIParseError(QAPIError): +class QAPIParseError(QAPISourceError): + """Error class for all QAPI schema parsing errors.""" def __init__(self, parser, msg): col =3D 1 for ch in parser.src[parser.line_pos:parser.pos]: @@ -35,9 +47,8 @@ def __init__(self, parser, msg): col =3D (col + 7) % 8 + 1 else: col +=3D 1 - super().__init__(parser.info, col, msg) + super().__init__(parser.info, msg, col) =20 =20 -class QAPISemError(QAPIError): - def __init__(self, info, msg): - super().__init__(info, None, msg) +class QAPISemError(QAPISourceError): + """Error class for semantic QAPI errors.""" diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index 3f8338ade8..302b9eee81 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -45,7 +45,7 @@ def generate(schema_file: str, if match and match.end() !=3D len(prefix): msg =3D "funny character '{:s}' in prefix '{:s}'".format( prefix[match.end()], prefix) - raise QAPIError('', None, msg) + raise QAPIError(msg) =20 schema =3D QAPISchema(schema_file) gen_types(schema, output_dir, prefix, builtins) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 3023bab44b..121d8488d2 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -20,7 +20,7 @@ from typing import Optional =20 from .common import c_name, POINTER_SUFFIX -from .error import QAPIError, QAPISemError +from .error import QAPISourceError, QAPISemError from .expr import check_exprs from .parser import QAPISchemaParser =20 @@ -841,7 +841,7 @@ def _def_entity(self, ent): other_ent =3D self._entity_dict.get(ent.name) if other_ent: if other_ent.info: - where =3D QAPIError(other_ent.info, None, "previous defini= tion") + where =3D QAPISourceError(other_ent.info, "previous defini= tion") raise QAPISemError( ent.info, "'%s' is already defined\n%s" % (ent.name, where)) --=20 2.26.2 From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600811382; cv=none; d=zohomail.com; s=zohoarc; b=TzMP6CGBykGhIErnVx1gtJwlAlK8bIfrl4umBvAB4NN94s2GZaUnvxWMbzStPVZV9/xQg3wugRIkN2s0aa1E0Kt+EhnSi9o4DCQ5R3TLVCNVxTGyKTu2KpJUAFcVkYURiOGkSVcyc+mu0lPYk7dQGiKStAHLcOR23+34hnNhZQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600811382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d1w7A9tf/5Qzt1yH408ACdCWC7OW5p+S8aaxkJNuoPE=; b=h5r/we5K+91VFqSu9reftQF52udBZ3BC54EeBpQmU155QgE/0J2f8jU6nnRu2tUXcEvYQaCjY6bni2DU2DhMStuEqf4q2rEx6TULq38ecmLKlbg0E+KpjgRBmr9DnkzdhmSnIZLfjl/1zm490uiOu0wkPt6+WEcQdC0mts20+Eg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600811382137255.57908703808982; Tue, 22 Sep 2020 14:49:42 -0700 (PDT) Received: from localhost ([::1]:37452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqAO-00075s-Rf for importer@patchew.org; Tue, 22 Sep 2020 17:49:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpj9-0003L8-4R for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpj5-000750-JM for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-g7yzsh0ENwqX1za9HGQXlw-1; Tue, 22 Sep 2020 17:21:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1FE01DE09; Tue, 22 Sep 2020 21:21:21 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FB0D5DE86; Tue, 22 Sep 2020 21:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1w7A9tf/5Qzt1yH408ACdCWC7OW5p+S8aaxkJNuoPE=; b=ZLqGX4uNnQwFkGCCuOEd2ryka/C/DNnHVQDI0SjdpnKJ+IPwAVmlhd3syXnMPcZM85AxLB v+8c/JEn8CwXKy69grz5qihFFTyC29DekGYczcNSmwq+XTekoQFUN7wVIWMHg3yb2ccqz9 xXc0XSL5Bm6Tku8M83sK5CbmSqbhprE= X-MC-Unique: g7yzsh0ENwqX1za9HGQXlw-1 From: John Snow To: Markus Armbruster Subject: [PATCH 2/6] qapi/parser.py: remove parser context from QAPIDoc Date: Tue, 22 Sep 2020 17:21:11 -0400 Message-Id: <20200922212115.4084301-3-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We only need the parser context for the purpose of raising exceptions. What we can do instead is to raise a unique document parsing error and affix additional context from the caller. This way, the document parsing can be isolated. Signed-off-by: John Snow based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- scripts/qapi/parser.py | 56 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 327cf05736..cb2595ce60 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -18,10 +18,14 @@ import re from collections import OrderedDict =20 -from .error import QAPIParseError, QAPISemError +from .error import QAPIError, QAPIParseError, QAPISemError from .source import QAPISourceInfo =20 =20 +class QAPIDocError(QAPIError): + """Documentation parsing error.""" + + class QAPISchemaParser: =20 def __init__(self, fname, previously_included=3DNone, incl_info=3DNone= ): @@ -265,13 +269,13 @@ def get_expr(self, nested): self, "expected '{', '[', string, boolean or 'null'") return expr =20 - def get_doc(self, info): + def _get_doc(self, info): if self.val !=3D '##': raise QAPIParseError( self, "junk after '##' at start of documentation comment") =20 docs =3D [] - cur_doc =3D QAPIDoc(self, info) + cur_doc =3D QAPIDoc(info) self.accept(False) while self.tok =3D=3D '#': if self.val.startswith('##'): @@ -292,12 +296,22 @@ def get_doc(self, info): if cur_doc.body.text: cur_doc.end_comment() docs.append(cur_doc) - cur_doc =3D QAPIDoc(self, info) + cur_doc =3D QAPIDoc(info) cur_doc.append(self.val) self.accept(False) =20 raise QAPIParseError(self, "documentation comment must end with '#= #'") =20 + def get_doc(self, info): + try: + return self._get_doc(info) + except QAPIDocError as err: + # Tie the Doc parsing error to our parsing state. The + # resulting error position depends on the state of the + # parser. It happens to be the beginning of the comment. + # More or less servicable, but action at a distance. + raise QAPIParseError(self, str(err)) from err + =20 class QAPIDoc: """ @@ -335,12 +349,7 @@ def __init__(self, name): def connect(self, member): self.member =3D member =20 - def __init__(self, parser, info): - # self._parser is used to report errors with QAPIParseError. The - # resulting error position depends on the state of the parser. - # It happens to be the beginning of the comment. More or less - # servicable, but action at a distance. - self._parser =3D parser + def __init__(self, info): self.info =3D info self.symbol =3D None self.body =3D QAPIDoc.Section() @@ -377,7 +386,7 @@ def append(self, line): return =20 if line[0] !=3D ' ': - raise QAPIParseError(self._parser, "missing space after #") + raise QAPIDocError("missing space after #") line =3D line[1:] self._append_line(line) =20 @@ -411,11 +420,11 @@ def _append_body_line(self, line): # recognized, and get silently treated as ordinary text if not self.symbol and not self.body.text and line.startswith('@'): if not line.endswith(':'): - raise QAPIParseError(self._parser, "line should end with '= :'") + raise QAPIDocError("line should end with ':'") self.symbol =3D line[1:-1] # FIXME invalid names other than the empty string aren't flagg= ed if not self.symbol: - raise QAPIParseError(self._parser, "invalid name") + raise QAPIDocError("invalid name") elif self.symbol: # This is a definition documentation block if name.startswith('@') and name.endswith(':'): @@ -498,9 +507,8 @@ def _append_various_line(self, line): name =3D line.split(' ', 1)[0] =20 if name.startswith('@') and name.endswith(':'): - raise QAPIParseError(self._parser, - "'%s' can't follow '%s' section" - % (name, self.sections[0].name)) + raise QAPIDocError("'%s' can't follow '%s' section" + % (name, self.sections[0].name)) if self._is_section_tag(name): line =3D line[len(name)+1:] self._start_section(name[:-1]) @@ -514,10 +522,9 @@ def _append_various_line(self, line): def _start_symbol_section(self, symbols_dict, name): # FIXME invalid names other than the empty string aren't flagged if not name: - raise QAPIParseError(self._parser, "invalid parameter name") + raise QAPIDocError("invalid parameter name") if name in symbols_dict: - raise QAPIParseError(self._parser, - "'%s' parameter name duplicated" % name) + raise QAPIDocError("'%s' parameter name duplicated" % name) assert not self.sections self._end_section() self._section =3D QAPIDoc.ArgSection(name) @@ -531,8 +538,7 @@ def _start_features_section(self, name): =20 def _start_section(self, name=3DNone): if name in ('Returns', 'Since') and self.has_section(name): - raise QAPIParseError(self._parser, - "duplicated '%s' section" % name) + raise QAPIDocError("duplicated '%s' section" % name) self._end_section() self._section =3D QAPIDoc.Section(name) self.sections.append(self._section) @@ -541,17 +547,15 @@ def _end_section(self): if self._section: text =3D self._section.text =3D self._section.text.strip() if self._section.name and (not text or text.isspace()): - raise QAPIParseError( - self._parser, + raise QAPIDocError( "empty doc section '%s'" % self._section.name) self._section =3D None =20 def _append_freeform(self, line): match =3D re.match(r'(@\S+:)', line) if match: - raise QAPIParseError(self._parser, - "'%s' not allowed in free-form documentat= ion" - % match.group(1)) + raise QAPIDocError("'%s' not allowed in free-form documentatio= n" + % match.group(1)) self._section.append(line) =20 def connect_member(self, member): --=20 2.26.2 From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600813083; cv=none; d=zohomail.com; s=zohoarc; b=Z85LIkfBW1L//ZdoHOg+l9/hCPDOgFBnPn40LmQoQIaAYZCedrccUuBdSNfv++jVEr1r/piRG4qDXohymzzOM8ZhAJS0Yzohmt2+ZihjcTJsGJwV7XatiTQmE548mmEVAZL+lxRRurTHuz1GgchKFgoRjZHY/HIX3+JQgM1VSG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600813083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=anPAbXBkp03pw8LMYlKFzKmngBz/OfqgdOSOuSjY1Y0=; b=Nq41Hcw3soESv5Gm2qb+Y7pGkHC4hLnRqyEpW9p7CWRshrZwQkXZC8VFbxJoj//vfuFb3rbsSOMnmnTCWE+/vy3/EvR7TXcRsBLCTnq1PySsc2iUCYZh9evt2YGA+wGXXSmW8Ax78wCAmz62Q2j0ydA2uyeSdIV12uQ/SmsaVl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600813083261717.9269607063105; Tue, 22 Sep 2020 15:18:03 -0700 (PDT) Received: from localhost ([::1]:51072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqbp-0002zD-Pl for importer@patchew.org; Tue, 22 Sep 2020 18:18:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpjA-0003Nl-73 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:32 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:42969 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpj6-000758-4S for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-Ij-knH8KOamVazj3FUkOzQ-1; Tue, 22 Sep 2020 17:21:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E467C801ABC; Tue, 22 Sep 2020 21:21:22 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ADC25DE50; Tue, 22 Sep 2020 21:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=anPAbXBkp03pw8LMYlKFzKmngBz/OfqgdOSOuSjY1Y0=; b=d99Ev7SZEcWWfiBY8OvvTlJg8mosaQPcb8B6Pwf56yQL47HDj6Ma2LXNxbVgszRhVVJpcJ hr43GjCqzeOARnejrCbOPID5R1JONB9speXZ34a9Msn/0OuOxgYxFD/u+c5FjWmLm0auel crz7dG0YSCh/91Ltt5cUnYLQmEeEgZM= X-MC-Unique: Ij-knH8KOamVazj3FUkOzQ-1 From: John Snow To: Markus Armbruster Subject: [PATCH 3/6] qapi/error.py: move QAPIParseError to parser.py Date: Tue, 22 Sep 2020 17:21:12 -0400 Message-Id: <20200922212115.4084301-4-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 17:01:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- scripts/qapi/error.py | 12 ------------ scripts/qapi/parser.py | 14 +++++++++++++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/qapi/error.py b/scripts/qapi/error.py index 47f266f33d..ab6a0f6271 100644 --- a/scripts/qapi/error.py +++ b/scripts/qapi/error.py @@ -38,17 +38,5 @@ def __str__(self) -> str: return f"{loc}: {self.msg}" =20 =20 -class QAPIParseError(QAPISourceError): - """Error class for all QAPI schema parsing errors.""" - def __init__(self, parser, msg): - col =3D 1 - for ch in parser.src[parser.line_pos:parser.pos]: - if ch =3D=3D '\t': - col =3D (col + 7) % 8 + 1 - else: - col +=3D 1 - super().__init__(parser.info, msg, col) - - class QAPISemError(QAPISourceError): """Error class for semantic QAPI errors.""" diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index cb2595ce60..7e7eda9ed9 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -18,10 +18,22 @@ import re from collections import OrderedDict =20 -from .error import QAPIError, QAPIParseError, QAPISemError +from .error import QAPIError, QAPISourceError, QAPISemError from .source import QAPISourceInfo =20 =20 +class QAPIParseError(QAPISourceError): + """Error class for all QAPI schema parsing errors.""" + def __init__(self, parser, msg): + col =3D 1 + for ch in parser.src[parser.line_pos:parser.pos]: + if ch =3D=3D '\t': + col =3D (col + 7) % 8 + 1 + else: + col +=3D 1 + super().__init__(parser.info, msg, col) + + class QAPIDocError(QAPIError): """Documentation parsing error.""" =20 --=20 2.26.2 From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600811228; cv=none; d=zohomail.com; s=zohoarc; b=HnqCPWb1vhBel1cvQzFULNzBdUx6o4em4+ckcDwTMy4YvAV38mnFXatgxhlon37FLNJ5RUiQJGF4UnXoXL2GVJvbPWpwH8MbVAKxeDqcdruBG0ElxxjBNvpIQ1lOLgaCc5Z9cBOwapCOu8XIoGFAW+YN+7jdtbMy9AqseWzdrgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600811228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+2DkJ41FXrYPe/QdNiQI4Frq9BhZCYdbi+2TVHr0zEY=; b=gjD88dLFm1elK1r5OlU13nw/gwiqV7wddgbLGY5PO0sWz2eXedCoUAtB3/Pa5astZNE7DdxQDhFE0vtJGPYjncGkTtR1p/5cD+E5Un9Nj/BR82NisDTaNqwDw0uTrumhI+BPWqdrXkZrj96T7cpo9iGZaSdbxHzHh4qcIoIsXt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600811228155854.6335010882174; Tue, 22 Sep 2020 14:47:08 -0700 (PDT) Received: from localhost ([::1]:56650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq7u-0003Oz-Cc for importer@patchew.org; Tue, 22 Sep 2020 17:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpjO-0003kF-U7 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpjL-00076E-RI for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-465-PDM9HDmtOtOMJqa7tSIuSQ-1; Tue, 22 Sep 2020 17:21:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF0298030B8; Tue, 22 Sep 2020 21:21:23 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B2F65DA7B; Tue, 22 Sep 2020 21:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+2DkJ41FXrYPe/QdNiQI4Frq9BhZCYdbi+2TVHr0zEY=; b=DSqsYwofmjrrMK5MU2MD4SvgOND6UQi4+zW2cnirVAnb5UXNpM24L8EldlsdMYVN201NFF YaQ+DZXK06Ajl/GnzgeMaRa+2sUAPAJVgLb5R467m9HiLDkDBVTHy2nSiBT/l4b/yaMNvJ bluk9LeKM+4QGFPM92IJ1jVV53VoB78= X-MC-Unique: PDM9HDmtOtOMJqa7tSIuSQ-1 From: John Snow To: Markus Armbruster Subject: [PATCH 4/6] qapi/parser.py: refactor QAPIParseError Date: Tue, 22 Sep 2020 17:21:13 -0400 Message-Id: <20200922212115.4084301-5-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Instead of rewriting the constructor with arguments incompatible to the base class we're extending, add a constructor-like class method that accepts a QAPISchemaParser as an argument and builds the correct Exception type. Because this is a little extra typing, create a new helper in QAPISchemaParser to build these exception objects. Signed-off-by: John Snow based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- scripts/qapi/parser.py | 58 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 7e7eda9ed9..8be4570c31 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -17,6 +17,7 @@ import os import re from collections import OrderedDict +from typing import Type, TypeVar =20 from .error import QAPIError, QAPISourceError, QAPISemError from .source import QAPISourceInfo @@ -24,14 +25,18 @@ =20 class QAPIParseError(QAPISourceError): """Error class for all QAPI schema parsing errors.""" - def __init__(self, parser, msg): + + T =3D TypeVar('T', bound=3D'QAPIParseError') + + @classmethod + def make(cls: Type[T], parser: 'QAPISchemaParser', msg: str) -> T: col =3D 1 for ch in parser.src[parser.line_pos:parser.pos]: if ch =3D=3D '\t': col =3D (col + 7) % 8 + 1 else: col +=3D 1 - super().__init__(parser.info, msg, col) + return cls(parser.info, msg, col) =20 =20 class QAPIDocError(QAPIError): @@ -112,6 +117,9 @@ def __init__(self, fname, previously_included=3DNone, i= ncl_info=3DNone): cur_doc =3D None self.reject_expr_doc(cur_doc) =20 + def _parse_error(self, msg: str) -> QAPIParseError: + return QAPIParseError.make(self, msg) + @staticmethod def reject_expr_doc(doc): if doc and doc.symbol: @@ -183,13 +191,12 @@ def accept(self, skip_comment=3DTrue): ch =3D self.src[self.cursor] self.cursor +=3D 1 if ch =3D=3D '\n': - raise QAPIParseError(self, "missing terminating \"= '\"") + raise self._parse_error("missing terminating \"'\"= ") if esc: # Note: we recognize only \\ because we have # no use for funny characters in strings if ch !=3D '\\': - raise QAPIParseError(self, - "unknown escape \\%s" % c= h) + raise self._parse_error(f"unknown escape \\{ch= }") esc =3D False elif ch =3D=3D '\\': esc =3D True @@ -198,8 +205,7 @@ def accept(self, skip_comment=3DTrue): self.val =3D string return if ord(ch) < 32 or ord(ch) >=3D 127: - raise QAPIParseError( - self, "funny character in string") + raise self._parse_error("funny character in string= ") string +=3D ch elif self.src.startswith('true', self.pos): self.val =3D True @@ -220,7 +226,7 @@ def accept(self, skip_comment=3DTrue): # character match =3D re.match('[^[\\]{}:,\\s\'"]+', self.src[self.cursor-1:]) - raise QAPIParseError(self, "stray '%s'" % match.group(0)) + raise self._parse_error("stray '%s'" % match.group(0)) =20 def get_members(self): expr =3D OrderedDict() @@ -228,24 +234,24 @@ def get_members(self): self.accept() return expr if self.tok !=3D "'": - raise QAPIParseError(self, "expected string or '}'") + raise self._parse_error("expected string or '}'") while True: key =3D self.val self.accept() if self.tok !=3D ':': - raise QAPIParseError(self, "expected ':'") + raise self._parse_error("expected ':'") self.accept() if key in expr: - raise QAPIParseError(self, "duplicate key '%s'" % key) + raise self._parse_error("duplicate key '%s'" % key) expr[key] =3D self.get_expr(True) if self.tok =3D=3D '}': self.accept() return expr if self.tok !=3D ',': - raise QAPIParseError(self, "expected ',' or '}'") + raise self._parse_error("expected ',' or '}'") self.accept() if self.tok !=3D "'": - raise QAPIParseError(self, "expected string") + raise self._parse_error("expected string") =20 def get_values(self): expr =3D [] @@ -253,20 +259,20 @@ def get_values(self): self.accept() return expr if self.tok not in "{['tfn": - raise QAPIParseError( - self, "expected '{', '[', ']', string, boolean or 'null'") + raise self._parse_error( + "expected '{', '[', ']', string, boolean or 'null'") while True: expr.append(self.get_expr(True)) if self.tok =3D=3D ']': self.accept() return expr if self.tok !=3D ',': - raise QAPIParseError(self, "expected ',' or ']'") + raise self._parse_error("expected ',' or ']'") self.accept() =20 def get_expr(self, nested): if self.tok !=3D '{' and not nested: - raise QAPIParseError(self, "expected '{'") + raise self._parse_error("expected '{'") if self.tok =3D=3D '{': self.accept() expr =3D self.get_members() @@ -277,14 +283,14 @@ def get_expr(self, nested): expr =3D self.val self.accept() else: - raise QAPIParseError( - self, "expected '{', '[', string, boolean or 'null'") + raise self._parse_error( + "expected '{', '[', string, boolean or 'null'") return expr =20 def _get_doc(self, info): if self.val !=3D '##': - raise QAPIParseError( - self, "junk after '##' at start of documentation comment") + raise self._parse_error( + "junk after '##' at start of documentation comment") =20 docs =3D [] cur_doc =3D QAPIDoc(info) @@ -293,8 +299,7 @@ def _get_doc(self, info): if self.val.startswith('##'): # End of doc comment if self.val !=3D '##': - raise QAPIParseError( - self, + raise self._parse_error( "junk after '##' at end of documentation comment") cur_doc.end_comment() docs.append(cur_doc) @@ -302,8 +307,7 @@ def _get_doc(self, info): return docs if self.val.startswith('# =3D'): if cur_doc.symbol: - raise QAPIParseError( - self, + raise self._parse_error( "unexpected '=3D' markup in definition documentati= on") if cur_doc.body.text: cur_doc.end_comment() @@ -312,7 +316,7 @@ def _get_doc(self, info): cur_doc.append(self.val) self.accept(False) =20 - raise QAPIParseError(self, "documentation comment must end with '#= #'") + raise self._parse_error("documentation comment must end with '##'") =20 def get_doc(self, info): try: @@ -322,7 +326,7 @@ def get_doc(self, info): # resulting error position depends on the state of the # parser. It happens to be the beginning of the comment. # More or less servicable, but action at a distance. - raise QAPIParseError(self, str(err)) from err + raise self._parse_error(str(err)) from err =20 =20 class QAPIDoc: --=20 2.26.2 From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812930; cv=none; d=zohomail.com; s=zohoarc; b=CT2nXOSZcNcSWaaTFfOvcma21+6D+Pn74Sx1wcCcwxv8u9Vxc34BPcprt2VQRTkPZQ7eVEhtvS/a6Q8KuKOmENV1tJxURlAFCLrBV2tiTAi2mc2up+4MqBBEOaP+G+6+oY62NCPx9EkFHJqXCAQleuuWAPHFrXolW0/Ic+m4YeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812930; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5GVvDQYp0TnOjt7xNepR3r+ccvUEcfx1XBFLgTKdNoU=; b=CtR42YGrvA5HARbJEVR8p8/Kcl5JoDjyMAgwPZe90+NNTPf5Mcl+1UnMIvK5aCPK+a22W+Tt71bSJjqMotJC/8R2xmuIeM+Ekx8119ZRkf2RepF6zkJ5UsFVLzDAefSPWCanNHZoelFKvY0MFejSn54CLXc2srVIQ3hO1QivaL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812930516364.65494238808617; Tue, 22 Sep 2020 15:15:30 -0700 (PDT) Received: from localhost ([::1]:46900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqZN-00015q-0N for importer@patchew.org; Tue, 22 Sep 2020 18:15:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpj9-0003LW-94 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30096) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpj6-00075A-C8 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-266-FWHKJ7ZKOsKLjfgY2Ob8DA-1; Tue, 22 Sep 2020 17:21:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E74B010059A8; Tue, 22 Sep 2020 21:21:24 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 251A45DE86; Tue, 22 Sep 2020 21:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5GVvDQYp0TnOjt7xNepR3r+ccvUEcfx1XBFLgTKdNoU=; b=NOnhT3V5XxzHonphbxVih6wAThD3qwwxOAboRqdHKICrkg1IQaVHdijr9QyctO4/2S1B09 dJy4qhblIItjIDQUsHgdfI8B7XoeyVOjwtw7pD0wkNqRjRzOrJDMeM3ljc3TL1EQSE/U9+ l6WJ9Z1va8b7wxPLoQ50f1LwPo4op/E= X-MC-Unique: FWHKJ7ZKOsKLjfgY2Ob8DA-1 From: John Snow To: Markus Armbruster Subject: [PATCH 5/6] qapi/error.py: enable mypy checks Date: Tue, 22 Sep 2020 17:21:14 -0400 Message-Id: <20200922212115.4084301-6-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- scripts/qapi/mypy.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index df9b05e4ab..4d341c6b2d 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -4,11 +4,6 @@ strict_optional =3D False disallow_untyped_calls =3D False python_version =3D 3.6 =20 -[mypy-qapi.error] -disallow_untyped_defs =3D False -disallow_incomplete_defs =3D False -check_untyped_defs =3D False - [mypy-qapi.parser] disallow_untyped_defs =3D False disallow_incomplete_defs =3D False --=20 2.26.2 From nobody Mon May 6 00:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812992; cv=none; d=zohomail.com; s=zohoarc; b=gvtoCTPGbYkMu8Z0Of29L6dQxQsEnBg08gJIr3Yu0ax/rWAIuPVhqfeoMjzxoNNxbX5CPO2XP6o76YNdTEbWhOSEz/pqMU+V8Wx5JI8Ajkgs1I1JWSNYtGarwbBWWOp9aWJoc0jNVJ1qo8quRAKBVNpNGcwf7DpmP8a7AmSOb+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812992; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0kk2aiwbBpvBqKrIaMAbC3XrkAlYeJd7sDOVP9w+HbQ=; b=L1VjP1JxRlJrjWJSbptQrFDUDSDRUoMq8aMBUrWLQcceIhF61gxJ/o1CpFPVhHchvMbzpVcOfQWZd+n5/EpevqQ48DSsbznMLY/pvi5puXlbin+nEKEEDJxp4WnK50CiUHEq8MVU+0ukYTX9xu1eDu3+RF0CsvwnjJVdsL+bF0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812992518514.3136610631494; Tue, 22 Sep 2020 15:16:32 -0700 (PDT) Received: from localhost ([::1]:49002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqaN-00024Y-Ah for importer@patchew.org; Tue, 22 Sep 2020 18:16:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpjA-0003NU-3G for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpj7-00075H-Gc for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:21:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-esChXbRRNzW4xXmOB09kNw-1; Tue, 22 Sep 2020 17:21:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD360186DD28; Tue, 22 Sep 2020 21:21:25 +0000 (UTC) Received: from scv.redhat.com (ovpn-119-140.rdu2.redhat.com [10.10.119.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E7375DA7B; Tue, 22 Sep 2020 21:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0kk2aiwbBpvBqKrIaMAbC3XrkAlYeJd7sDOVP9w+HbQ=; b=CHSxb/WobCNu+vBc629D2oXXOVUGKspoYEmfVDncf+9j+3mfCquRNT8kV2WMauFvtu1291 bgB/OKK4QpieDYsAy33cuSon6/Nr6CMJMPFEEXk+ydjo5vl76wU3wyV4WYaT6M8uInnDqC ZvJXEWLw5b1nqB8y5y2EO02p8K21htc= X-MC-Unique: esChXbRRNzW4xXmOB09kNw-1 From: John Snow To: Markus Armbruster Subject: [PATCH 6/6] qapi/error.py: enable pylint checks Date: Tue, 22 Sep 2020 17:21:15 -0400 Message-Id: <20200922212115.4084301-7-jsnow@redhat.com> In-Reply-To: <20200922212115.4084301-1-jsnow@redhat.com> References: <20200922212115.4084301-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org, John Snow , Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow based-on: <20200922211802.4083666-1-jsnow@redhat.com> --- scripts/qapi/pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index fb0386d529..88efbf71cb 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -2,8 +2,7 @@ =20 # Add files or directories matching the regex patterns to the ignore list. # The regex matches against base names, not paths. -ignore-patterns=3Derror.py, - parser.py, +ignore-patterns=3Dparser.py, schema.py, =20 =20 --=20 2.26.2