From nobody Sun May 12 02:22:55 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=1621551828; cv=none; d=zohomail.com; s=zohoarc; b=NMs945/MWEnlM740VvH8NM2+NYuxipHlKLYCSr0nms09iWLPchrDxXstLUFbQlgJk1s3tVxn72taurqMg4h5sgbphQG7e55hTqX+21Y88fj/2KkwCBJvms5ugFzLnuC6o9Yr6/79SLX/U5tXOTjBccDWfOoZRdWF2/ObHbL9au8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551828; 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=8L2dNBFHnepsFnXeVP4wSaHtBxmZStINR161v2mwYvg=; b=E08qDlVCcCLPA1ZflvV+19qWrCBSkAOATF9N2YJ4dTaiunaScdlCH2lEIeJ27kZw5KgEeJwBsMHQRQEtYn3p59dVxZXnWz8FVg+sPBAiBFTZ15KUMzvgamp0qRGoto0W8IxfwsynN5vtBlPVNhbr2AighKhI+uvX8a3up5XCA0I= 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 1621551828678328.4916832827238; Thu, 20 May 2021 16:03:48 -0700 (PDT) Received: from localhost ([::1]:37010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljrhj-00017H-LU for importer@patchew.org; Thu, 20 May 2021 19:03:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbe-0006lT-M2 for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbT-0005ps-4j for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:28 -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-483-7E7RJKjKNoefnP8K-kZD4A-1; Thu, 20 May 2021 18:57:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14B31101371D; Thu, 20 May 2021 22:57:14 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC22D10027C4; Thu, 20 May 2021 22:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551437; 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=8L2dNBFHnepsFnXeVP4wSaHtBxmZStINR161v2mwYvg=; b=CCM3hTsQk8t8CMJLgONum4xJHYXJUM2pOFP6FJN5Fv8c6Gk56qPiMN2tHMD57ZqXc6hNZl uox/gL1Su0n7m1pLNtBBrc6AQTS7up+iPV8fYZ/LN/Mz4wbaI3bjIo6StMkaFLkkD0UGGG ZnPPoqujPmHrcwgCzS2NVpo9UbW7OYI= X-MC-Unique: 7E7RJKjKNoefnP8K-kZD4A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] qapi/parser: fix unused check_args_section arguments Date: Thu, 20 May 2021 18:57:05 -0400 Message-Id: <20210520225710.168356-2-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , John Snow , Eduardo Habkost , Markus Armbruster , 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" Pylint informs us we're not using these arguments. Oops, it's right. Correct the error message and remove the remaining unused parameter. Fix test output now that the error message is improved. Fixes: e151941d1b Signed-off-by: John Snow --- scripts/qapi/parser.py | 16 +++++++++------- tests/qapi-schema/doc-bad-feature.err | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 06167ed3e0a..b6a5e661215 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -753,16 +753,18 @@ def check_expr(self, expr): =20 def check(self): =20 - def check_args_section(args, info, what): + def check_args_section(args, what): bogus =3D [name for name, section in args.items() if not section.member] if bogus: raise QAPISemError( self.info, - "documented member%s '%s' %s not exist" - % ("s" if len(bogus) > 1 else "", - "', '".join(bogus), - "do" if len(bogus) > 1 else "does")) + "documented %s%s '%s' %s not exist" % ( + what, + "s" if len(bogus) > 1 else "", + "', '".join(bogus), + "do" if len(bogus) > 1 else "does" + )) =20 - check_args_section(self.args, self.info, 'members') - check_args_section(self.features, self.info, 'features') + check_args_section(self.args, 'member') + check_args_section(self.features, 'feature') diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-= bad-feature.err index e4c62adfa3e..49d1746c3d1 100644 --- a/tests/qapi-schema/doc-bad-feature.err +++ b/tests/qapi-schema/doc-bad-feature.err @@ -1 +1 @@ -doc-bad-feature.json:3: documented member 'a' does not exist +doc-bad-feature.json:3: documented feature 'a' does not exist --=20 2.30.2 From nobody Sun May 12 02:22:55 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=1621551748; cv=none; d=zohomail.com; s=zohoarc; b=Q5TqUmSzIpmcpHWUAma5Ob1q5ezqWKbqAlkHRKcesnfV44hxFPqf+Slxda0lPyln1uyQAYLwUUB7c8mz4ke92k87dR68Y4xgCR3xKlEzyCmyQhAWKTLv0iBhfnNtxmiui0NkW2Eo7XAgw0nzjjF4pKIuM5dwvwgdADpwS7h4Nbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551748; 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=ZuN9+wGrFGJBjwv9ZfJuudGHWkBH3ROY9IYtCNYRyxM=; b=ZQ6PcJDH8lpkXRTZRplH/Jc5IdZDvSjNJeFbDCGdw+kMizLGFLM5y0Kppn8GGmZ+YfU7Kvf7Zs61aTOd9nHgNoaKBaMCSaz7UBvdgS2zPayDn4qqfc/TQ9OkfJLv1nUrMgxOjGMGpvRFVXNhDzZZU7q3qubqQzadHgMYpAtPQ8s= 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 1621551748536407.5061813744294; Thu, 20 May 2021 16:02:28 -0700 (PDT) Received: from localhost ([::1]:33484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljrgQ-00079z-Jf for importer@patchew.org; Thu, 20 May 2021 19:02:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbe-0006lU-M6 for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbS-0005pP-2K for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:28 -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-532-6FnO3rMKMfuLrq_jnBx4Nw-1; Thu, 20 May 2021 18:57:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F20F81854E20; Thu, 20 May 2021 22:57:14 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E794100164A; Thu, 20 May 2021 22:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551437; 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=ZuN9+wGrFGJBjwv9ZfJuudGHWkBH3ROY9IYtCNYRyxM=; b=gRE4l4VqC9JdVUIQeot3/aMsyWgeEJrGlakO1RhORwEk5tq1PWixzp5jedvQS2uarg16Ly is6hq+eDtnN1ujhfEbNQUFvJtFZSytYoRgMiJGMPamI7N0SZ6j3JLcsaXVhgFzWUybLAcu 1NDBmCJYX+SRaAQ9bJ8bRVRRuHNV3+8= X-MC-Unique: 6FnO3rMKMfuLrq_jnBx4Nw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] qapi/parser: Allow empty QAPIDoc Sections Date: Thu, 20 May 2021 18:57:06 -0400 Message-Id: <20210520225710.168356-3-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , John Snow , Eduardo Habkost , Markus Armbruster , 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" It simplifies the typing to say that _section is always a QAPIDoc.Section(). To accommodate this change, we must allow for this object to evaluate to False for functions like _end_section which behave differently based on whether or not a Section has been started. Signed-off-by: John Snow --- Probably a better fix is to restructure the code to prevent empty sections from being "ended", but that seems like a bigger whale than what I'm after at the immediate moment. Signed-off-by: John Snow --- scripts/qapi/parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index b6a5e661215..3ddde318376 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -456,6 +456,9 @@ def __init__(self, parser, name=3DNone, indent=3D0): # the expected indent level of the text of this section self._indent =3D indent =20 + def __bool__(self) -> bool: + return bool(self.name or self.text) + def append(self, line): # Strip leading spaces corresponding to the expected indent le= vel # Blank lines are always OK. @@ -722,7 +725,7 @@ def _end_section(self): raise QAPIParseError( self._parser, "empty doc section '%s'" % self._section.name) - self._section =3D None + self._section =3D QAPIDoc.Section(self._parser) =20 def _append_freeform(self, line): match =3D re.match(r'(@\S+:)', line) --=20 2.30.2 From nobody Sun May 12 02:22:55 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=1621551601; cv=none; d=zohomail.com; s=zohoarc; b=ReXFFnLOyk4nwZuJ9AP3FPFxsAwau2GSH6aLmtmaDMTvV17RRhdcWoWKMvRYF8O99+8tkYsEvkG0e2HZuCBQIKlOiMF3TENcwIO9vbjxNlHCfvLsCtVBcPyMmV4Xatw7vx0sCiaOAWuHiu8yN5xuQjk03freHdiD6WtE/fP5kiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551601; 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=lzr1C+qkFSanMjCLgP5ZnvZTHsh5YAWeahJVTu3P3ds=; b=glCY6zz3Ng6xKSc8pLmE0WBjOc6GJJx6LeUxvK5Y2zgFHB7TgsBxKFmSU7cu0WaPKXtdeMUrYiGo3n76ZGN3Y1DnWSA8vmGHJEg06hT2t8veEgNISVOWisvmSpwXHXtGNOjSZflhePpZUQT52mRNKQFgyG0rv+fJuWdIS78pvCU= 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 1621551601930448.7121366095936; Thu, 20 May 2021 16:00:01 -0700 (PDT) Received: from localhost ([::1]:55214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljre4-0002kV-O6 for importer@patchew.org; Thu, 20 May 2021 19:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbb-0006lE-2Z for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbU-0005sM-8L for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:26 -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-493-i87FstmwNEOMgq5sq-SI5g-1; Thu, 20 May 2021 18:57:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33D7764149; Thu, 20 May 2021 22:57:16 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24A3C100EBAD; Thu, 20 May 2021 22:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551439; 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=lzr1C+qkFSanMjCLgP5ZnvZTHsh5YAWeahJVTu3P3ds=; b=RytPB0okNN6fr3ZW5fiTpI2QZ0RXvhMaWNMpaDGd3r1OG4YRRKWKQWX5cF8oFIwTevHlke ppevxvgbxbFy6H4cAdZFTPRPmQc81lcii0fTDRbAfEUw3FGOIfUe4dSVEaSXonqFDg4cg9 i9MhAFwNOGahzNO63umS+F0w2m6NpKo= X-MC-Unique: i87FstmwNEOMgq5sq-SI5g-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] qapi/parser: add type hint annotations (QAPIDoc) Date: Thu, 20 May 2021 18:57:07 -0400 Message-Id: <20210520225710.168356-4-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=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 , John Snow , Eduardo Habkost , Markus Armbruster , 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" Annotations do not change runtime behavior. This commit adds mostly annotations, but uses a TYPE_CHECKING runtime check to conditionally import dependencies, which only triggers during runs of mypy. Signed-off-by: John Snow --- TopLevelExpr, an idea from previous drafts, makes a return here in order to give a semantic meaning to check_expr(). The type is intended to be used more in forthcoming commits (pt5c), but I opted to include it now instead of creating yet-another Dict[str, object] type hint that I would forget to change later. Signed-off-by: John Snow --- scripts/qapi/parser.py | 77 ++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 3ddde318376..b1e2fa5c577 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -18,6 +18,7 @@ import os import re from typing import ( + TYPE_CHECKING, Dict, List, Optional, @@ -30,6 +31,15 @@ from .source import QAPISourceInfo =20 =20 +if TYPE_CHECKING: + # pylint: disable=3Dcyclic-import + # TODO: Remove cycle. [schema -> expr -> parser -> schema] + from .schema import QAPISchemaFeature, QAPISchemaMember + + +#: Represents a single Top Level QAPI schema expression. +TopLevelExpr =3D Dict[str, object] + # Return value alias for get_expr(). _ExprValue =3D Union[List[object], Dict[str, object], str, bool] =20 @@ -447,7 +457,8 @@ class QAPIDoc: """ =20 class Section: - def __init__(self, parser, name=3DNone, indent=3D0): + def __init__(self, parser: QAPISchemaParser, + name: Optional[str] =3D None, indent: int =3D 0): # parser, for error messages about indentation self._parser =3D parser # optional section name (argument/member or section name) @@ -459,7 +470,7 @@ def __init__(self, parser, name=3DNone, indent=3D0): def __bool__(self) -> bool: return bool(self.name or self.text) =20 - def append(self, line): + def append(self, line: str) -> None: # Strip leading spaces corresponding to the expected indent le= vel # Blank lines are always OK. if line: @@ -474,39 +485,40 @@ def append(self, line): self.text +=3D line.rstrip() + '\n' =20 class ArgSection(Section): - def __init__(self, parser, name, indent=3D0): + def __init__(self, parser: QAPISchemaParser, + name: Optional[str] =3D None, indent: int =3D 0): super().__init__(parser, name, indent) - self.member =3D None + self.member: Optional['QAPISchemaMember'] =3D None =20 - def connect(self, member): + def connect(self, member: 'QAPISchemaMember') -> None: self.member =3D member =20 - def __init__(self, parser, info): + def __init__(self, parser: QAPISchemaParser, info: QAPISourceInfo): # 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 self.info =3D info - self.symbol =3D None + self.symbol: Optional[str] =3D None self.body =3D QAPIDoc.Section(parser) # dict mapping parameter name to ArgSection - self.args =3D OrderedDict() - self.features =3D OrderedDict() + self.args: Dict[str, QAPIDoc.ArgSection] =3D OrderedDict() + self.features: Dict[str, QAPIDoc.ArgSection] =3D OrderedDict() # a list of Section - self.sections =3D [] + self.sections: List[QAPIDoc.Section] =3D [] # the current section self._section =3D self.body self._append_line =3D self._append_body_line =20 - def has_section(self, name): + def has_section(self, name: str) -> bool: """Return True if we have a section with this name.""" for i in self.sections: if i.name =3D=3D name: return True return False =20 - def append(self, line): + def append(self, line: str) -> None: """ Parse a comment line and add it to the documentation. =20 @@ -527,18 +539,18 @@ def append(self, line): line =3D line[1:] self._append_line(line) =20 - def end_comment(self): + def end_comment(self) -> None: self._end_section() =20 @staticmethod - def _is_section_tag(name): + def _is_section_tag(name: str) -> bool: return name in ('Returns:', 'Since:', # those are often singular or plural 'Note:', 'Notes:', 'Example:', 'Examples:', 'TODO:') =20 - def _append_body_line(self, line): + def _append_body_line(self, line: str) -> None: """ Process a line of documentation text in the body section. =20 @@ -578,7 +590,7 @@ def _append_body_line(self, line): # This is a free-form documentation block self._append_freeform(line) =20 - def _append_args_line(self, line): + def _append_args_line(self, line: str) -> None: """ Process a line of documentation text in an argument section. =20 @@ -624,7 +636,7 @@ def _append_args_line(self, line): =20 self._append_freeform(line) =20 - def _append_features_line(self, line): + def _append_features_line(self, line: str) -> None: name =3D line.split(' ', 1)[0] =20 if name.startswith('@') and name.endswith(':'): @@ -656,7 +668,7 @@ def _append_features_line(self, line): =20 self._append_freeform(line) =20 - def _append_various_line(self, line): + def _append_various_line(self, line: str) -> None: """ Process a line of documentation text in an additional section. =20 @@ -692,7 +704,11 @@ def _append_various_line(self, line): =20 self._append_freeform(line) =20 - def _start_symbol_section(self, symbols_dict, name, indent): + def _start_symbol_section( + self, + symbols_dict: Dict[str, 'QAPIDoc.ArgSection'], + name: str, + indent: int) -> None: # FIXME invalid names other than the empty string aren't flagged if not name: raise QAPIParseError(self._parser, "invalid parameter name") @@ -704,13 +720,14 @@ def _start_symbol_section(self, symbols_dict, name, i= ndent): self._section =3D QAPIDoc.ArgSection(self._parser, name, indent) symbols_dict[name] =3D self._section =20 - def _start_args_section(self, name, indent): + def _start_args_section(self, name: str, indent: int) -> None: self._start_symbol_section(self.args, name, indent) =20 - def _start_features_section(self, name, indent): + def _start_features_section(self, name: str, indent: int) -> None: self._start_symbol_section(self.features, name, indent) =20 - def _start_section(self, name=3DNone, indent=3D0): + def _start_section(self, name: Optional[str] =3D None, + indent: int =3D 0) -> None: if name in ('Returns', 'Since') and self.has_section(name): raise QAPIParseError(self._parser, "duplicated '%s' section" % name) @@ -718,7 +735,7 @@ def _start_section(self, name=3DNone, indent=3D0): self._section =3D QAPIDoc.Section(self._parser, name, indent) self.sections.append(self._section) =20 - def _end_section(self): + def _end_section(self) -> None: if self._section: text =3D self._section.text =3D self._section.text.strip() if self._section.name and (not text or text.isspace()): @@ -727,7 +744,7 @@ def _end_section(self): "empty doc section '%s'" % self._section.name) self._section =3D QAPIDoc.Section(self._parser) =20 - def _append_freeform(self, line): + def _append_freeform(self, line: str) -> None: match =3D re.match(r'(@\S+:)', line) if match: raise QAPIParseError(self._parser, @@ -735,28 +752,30 @@ def _append_freeform(self, line): % match.group(1)) self._section.append(line) =20 - def connect_member(self, member): + def connect_member(self, member: 'QAPISchemaMember') -> None: if member.name not in self.args: # Undocumented TODO outlaw self.args[member.name] =3D QAPIDoc.ArgSection(self._parser, member.name) self.args[member.name].connect(member) =20 - def connect_feature(self, feature): + def connect_feature(self, feature: 'QAPISchemaFeature') -> None: if feature.name not in self.features: raise QAPISemError(feature.info, "feature '%s' lacks documentation" % feature.name) self.features[feature.name].connect(feature) =20 - def check_expr(self, expr): + def check_expr(self, expr: TopLevelExpr) -> None: if self.has_section('Returns') and 'command' not in expr: raise QAPISemError(self.info, "'Returns:' is only valid for commands") =20 - def check(self): + def check(self) -> None: =20 - def check_args_section(args, what): + def check_args_section( + args: Dict[str, QAPIDoc.ArgSection], what: str + ) -> None: bogus =3D [name for name, section in args.items() if not section.member] if bogus: --=20 2.30.2 From nobody Sun May 12 02:22:55 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=1621551575; cv=none; d=zohomail.com; s=zohoarc; b=gNS0CCPNz5wKy2EYRRR5qFy6gvRN8oo82sA6kPEh0otGpEzQOo1NtTcHfkFQgg3BJLt3mlRu1guO8Hf5slppuVYQLXHJaO1UiiksKBXGU7ZD9iQhkq5Xs8vevlQ8lR1eIF5KX7EDjMa/CiQUjl2Vg+PgaBVRv+e2YSC/qRNae2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551575; 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=HvqhhbZw6hUZeuo8Xk+YsspTx9t9T5CuhfZfuoRdCcA=; b=WZkPKxj3MlQBCMgylmP0BpGXeFRM3jqfHkB50yX4sh/k/uS4SjYRqFjNfmd0SNwh4zGWtbIfXpLL2Qx0YQ/qnCQSWJw17WtezdONAI1wSS10Kf26BJwUqvwVP59QEdYdfjbZ8wmfFUaXsTE7hgem9zs6desrSZ/4m/yFSViVgvQ= 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 1621551575322141.25909070336468; Thu, 20 May 2021 15:59:35 -0700 (PDT) Received: from localhost ([::1]:52718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljrde-00014s-Bi for importer@patchew.org; Thu, 20 May 2021 18:59:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbh-0006nB-Fc for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbV-0005sV-04 for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57: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-582-IMmlyBLSMpuzN7Tt_HhKvg-1; Thu, 20 May 2021 18:57:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F171800D62; Thu, 20 May 2021 22:57:17 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EE90100164A; Thu, 20 May 2021 22:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551439; 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=HvqhhbZw6hUZeuo8Xk+YsspTx9t9T5CuhfZfuoRdCcA=; b=eTUMQxmVhC2zC+FDMott33FcKzIfda0tN3u2S2swnLfOH4DWrle/isqov1/aA8VEa2WHbT wYKwwF85tEr/ir/dG+2agn1ZXmmeK7YkR54ylazKi+ST5wN/zb44AxCUv16x49HJvZoWkJ t/sShlIF2YSVmA/ui7hUdaLsnE3jHtY= X-MC-Unique: IMmlyBLSMpuzN7Tt_HhKvg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] qapi/parser: enable mypy checks Date: Thu, 20 May 2021 18:57:08 -0400 Message-Id: <20210520225710.168356-5-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , John Snow , Eduardo Habkost , Markus Armbruster , 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 --- As always, this can be merged with the previous commit. Signed-off-by: John Snow --- scripts/qapi/mypy.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index 54ca4483d6d..66253564297 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -3,11 +3,6 @@ strict =3D True disallow_untyped_calls =3D False python_version =3D 3.6 =20 -[mypy-qapi.parser] -disallow_untyped_defs =3D False -disallow_incomplete_defs =3D False -check_untyped_defs =3D False - [mypy-qapi.schema] disallow_untyped_defs =3D False disallow_incomplete_defs =3D False --=20 2.30.2 From nobody Sun May 12 02:22:55 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=1621551683; cv=none; d=zohomail.com; s=zohoarc; b=DBkMTmcyI++HMpF/eU9FSouVCeHvM8Tc3+IfruHPNST325DaBtMBMPCFvx3Y1kD4GJgNmIah+mQA3mVBKZ5VkkU/1jc3hHQorxcCabi1boW20gUZ5WO2laApbzp4voLahKOwBBSDfmq/Rj2QQuMXc9b5eDzpHfw2EvLeaQiWabA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551683; 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=WF+P9k9Q73W7EVmQkitr3i527MS/sU1j5RDgjDIerzg=; b=nROSeYYGVNfQaEbcnB6SjtSANpOdUyZq38Q+smomEa1EQkBQfei+gftvc/FCQ28A6Bg/LtOREuPi0rBnuJV7SoaIAbGTbTCNm5/t8iMFT+fKDihptZE2TJIbG1qk8ug3VFKibsBSdA2i9MYIpbuWCQUIlKrX2FvToyd7xbItHEI= 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 1621551683840924.661653544743; Thu, 20 May 2021 16:01:23 -0700 (PDT) Received: from localhost ([::1]:59362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljrfO-0005XS-LF for importer@patchew.org; Thu, 20 May 2021 19:01:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbh-0006n9-D5 for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbV-0005sc-0J for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:33 -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-584-XdiszZu5P_2ypfOWj7AJLQ-1; Thu, 20 May 2021 18:57:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25D3D8015DB; Thu, 20 May 2021 22:57:18 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 657461009962; Thu, 20 May 2021 22:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551440; 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=WF+P9k9Q73W7EVmQkitr3i527MS/sU1j5RDgjDIerzg=; b=WWFCLwcFh0xCUpcj5XWzsjTWim1DWCLwRBY8l8Lp6RtWFsK0OTJNoNbq9enzH1b8wysUMk vugcQZpl4MiNrOlnIwSkpVH9u8x3pHJFqJmN7RqajIQOSRHgeUiApUK1kl1lbTkxRi/KIv m2iv6gL8oM2bMLQvwO1pvkLrhr26IFI= X-MC-Unique: XdiszZu5P_2ypfOWj7AJLQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] qapi/parser: Silence too-few-public-methods warning Date: Thu, 20 May 2021 18:57:09 -0400 Message-Id: <20210520225710.168356-6-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , John Snow , Eduardo Habkost , Markus Armbruster , 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" Eh. Two properties, a bool method and a public method are non-trivial enough for me. (Especially in typed python!) Signed-off-by: John Snow --- scripts/qapi/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index b1e2fa5c577..618e6e5b0dd 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -459,6 +459,8 @@ class QAPIDoc: class Section: def __init__(self, parser: QAPISchemaParser, name: Optional[str] =3D None, indent: int =3D 0): + # pylint: disable=3Dtoo-few-public-methods + # parser, for error messages about indentation self._parser =3D parser # optional section name (argument/member or section name) --=20 2.30.2 From nobody Sun May 12 02:22:55 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=1621551741; cv=none; d=zohomail.com; s=zohoarc; b=BPYGKRM7orukJrDXjusDwbFQCdqlpq9brMzUdpCnMTiO7ZAOp3r+pphrQ2ldaLR19c7G3SAogkBcCFYFDBKaqurLhdI6YMQttOIc4uy6eeSAAO9bfx1X4axv3azY3JBx9mLFRdupmEckhY9Gpg8IORWayDksCSrdrJPBkkAGLAU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621551741; 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=e27B2dBE6Gg2lFvyql/xMKdibU0QfvtEdFIdL5p02YM=; b=SmEp6tFrGROqUWl0W4YVm6n9i5hKqX6pXi/Fy6CiT956u1tizq/8d+XQ2zbmcHOcm4LQMBGiJ99oTiDXCR6VU6Y3S9IJVB9X7mlS3D6icOjCNYMzeTLpHSsUK40QE7pNQ4PNPF2stT3Sh92tdaE4Kbg1JdHiwq0z5YWUckMzLeg= 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 1621551741746821.4700106106012; Thu, 20 May 2021 16:02:21 -0700 (PDT) Received: from localhost ([::1]:33014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljrgK-0006py-Mz for importer@patchew.org; Thu, 20 May 2021 19:02:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbe-0006lV-Ng for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljrbW-0005sr-Uj for qemu-devel@nongnu.org; Thu, 20 May 2021 18:57: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-517-QvkswVqRN_G9afxrJmRXPQ-1; Thu, 20 May 2021 18:57:20 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D27F1854E26; Thu, 20 May 2021 22:57:19 +0000 (UTC) Received: from scv.redhat.com (ovpn-117-64.rdu2.redhat.com [10.10.117.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EB52100EBAD; Thu, 20 May 2021 22:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621551442; 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=e27B2dBE6Gg2lFvyql/xMKdibU0QfvtEdFIdL5p02YM=; b=LEICjAUmQDyb8j+lJ4FWhByYPdJdJ3JFnUKDwMDSpx1181315xwKXKjR+NmS46PFGGexLm +P2cUjFe7in0EhKarrkOPR/Nqa+uyKd2ZtxvMwnAoqj5IDphRDjGPYM+2Bj9x2kmT/Yzny gkED7JwnNtDnD7ziZFl7p7fYH1g6Nmo= X-MC-Unique: QvkswVqRN_G9afxrJmRXPQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] qapi/parser: enable pylint checks Date: Thu, 20 May 2021 18:57:10 -0400 Message-Id: <20210520225710.168356-7-jsnow@redhat.com> In-Reply-To: <20210520225710.168356-1-jsnow@redhat.com> References: <20210520225710.168356-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=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 , John Snow , Eduardo Habkost , Markus Armbruster , 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 --- This can be merged with the previous commit, if desired. Signed-off-by: John Snow --- scripts/qapi/pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index c5275d5f59b..1a633b2b88e 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=3Dparser.py, - schema.py, +ignore-patterns=3Dschema.py, =20 =20 [MESSAGES CONTROL] --=20 2.30.2