From patchwork Tue Sep 22 21:17:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2BC6C2D0E2 for ; Tue, 22 Sep 2020 21:29:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27E04221E8 for ; Tue, 22 Sep 2020 21:29:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="B08ZxXg3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27E04221E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKprI-0005P1-Ml for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpfy-00077r-GE for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpfw-0006cU-ED for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809491; 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=RTDJzHDAZhCV6t90+MnWXmSr5yYGkuEX4Vl4khiBUxA=; b=B08ZxXg3POEF+bcZ9piSFvPTVtAkEbP72CuMWWrR5/pNCfpC0Q+iDW1HTkolhpdNT1Q9i7 Gr4fUdKnRyBvJCAlcdomvs1Rh2+V3rBTKEO7fJnRC8OvFKtSouIw6qP4W4YU5ZIRPIVW85 MoNoeAcEUTA+UbTVroejzHv75IWq67Q= 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-527-4fTgJ8i7M1SXiLk4lbtqog-1; Tue, 22 Sep 2020 17:18:09 -0400 X-MC-Unique: 4fTgJ8i7M1SXiLk4lbtqog-1 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 5C9D4186DD2D; Tue, 22 Sep 2020 21:18:08 +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 8DDD15DE86; Tue, 22 Sep 2020 21:18:07 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 01/14] qapi/doc.py: stash long temporary locals in named locals Date: Tue, 22 Sep 2020 17:17:49 -0400 Message-Id: <20200922211802.4083666-2-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 70f7cdfaa6..4743beb89a 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -267,15 +267,13 @@ def visit_command(self, name, info, ifcond, features, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig): doc = self.cur_doc - self._gen.add(texi_msg('Command', doc, ifcond, - texi_arguments(doc, - arg_type if boxed else None))) + members = texi_arguments(doc, arg_type if boxed else None) + self._gen.add(texi_msg('Command', doc, ifcond, members)) def visit_event(self, name, info, ifcond, features, arg_type, boxed): doc = self.cur_doc - self._gen.add(texi_msg('Event', doc, ifcond, - texi_arguments(doc, - arg_type if boxed else None))) + members = texi_arguments(doc, arg_type if boxed else None) + self._gen.add(texi_msg('Event', doc, ifcond, members)) def symbol(self, doc, entity): if self._gen._body: From patchwork Tue Sep 22 21:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2A02C2D0E2 for ; Tue, 22 Sep 2020 21:33:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60B2A20757 for ; Tue, 22 Sep 2020 21:33:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Oiik6lsA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60B2A20757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKpv2-0000lW-52 for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpg2-00079d-2U for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpfx-0006ce-UR for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809493; 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=b74oJYdLoSfqHVygXt9kzKk9vHZ6c5Y1WDerG8Zn2u0=; b=Oiik6lsA6p6shqs/Ews+8yBQWDpL0ezEpwqLnF1KfZaNWKDywYE4REHLlSeN9h7UgCpm2P eD2/bU2LxDqYdeqI8ZhEHeIoYtWiBdMsJ0af9MzT75vmbBk0st8dKHrt2W4B7BtI+vyaSx Nu4nU3zGHnw3jK9iWykD1Fqg2UEksS4= 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-129-PJ5FyfKQNcSybBGAgJwCtw-1; Tue, 22 Sep 2020 17:18:10 -0400 X-MC-Unique: PJ5FyfKQNcSybBGAgJwCtw-1 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 DB5C580ED9A; Tue, 22 Sep 2020 21:18:09 +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 A28A95DE50; Tue, 22 Sep 2020 21:18:08 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 02/14] qapi/doc.py: avoid unnecessary keyword arguments Date: Tue, 22 Sep 2020 17:17:50 -0400 Message-Id: <20200922211802.4083666-3-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Keyword Callables are hard to type in Python 3.6, avoid them if there's no urgent need to use them. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 4743beb89a..66333629d6 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -164,7 +164,8 @@ def texi_members(doc, what, base=None, variants=None, desc = 'One of ' + members_text + '\n' else: desc = 'Not documented\n' - items += member_func(section.member, desc, suffix='') + + items += member_func(section.member, desc, '') if base: items += '@item The members of @code{%s}\n' % base.doc_type() if variants: @@ -174,7 +175,7 @@ def texi_members(doc, what, base=None, variants=None, if v.type.is_implicit(): assert not v.type.base and not v.type.variants for m in v.type.local_members: - items += member_func(m, desc='', suffix=when) + items += member_func(m, '', when) else: items += '@item The members of @code{%s}%s\n' % ( v.type.doc_type(), when) From patchwork Tue Sep 22 21:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 479A2C2D0E2 for ; Tue, 22 Sep 2020 22:03:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B822B206B5 for ; Tue, 22 Sep 2020 22:03:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dOiaciak" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B822B206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqNs-0006jI-Oi for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:03:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpg3-0007BQ-OF for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpg1-0006d8-Br for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809496; 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=xN0yCdGye3vtSXNKYYdrnPY6HLeoGgrhJUfZGcNxYxQ=; b=dOiaciakPZyhMquBqUlH7aaFJRSw9vbfFT+/Z4VNwNBG0JUDGVC5wG/Ob+c6q3ftGGZOi9 5s4SiNaSeR71DpzA3nXOHmTciEN1H5kWn6IsU5JWDdlolmrYZigtBB0XauRvk6XI8dSHOM fVKKZ83tyF50hyZn7AdY+npeso35x3I= 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-275-Ct17_QhrPXu0Bubig_LNRg-1; Tue, 22 Sep 2020 17:18:12 -0400 X-MC-Unique: Ct17_QhrPXu0Bubig_LNRg-1 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 41F4A80EDA1; Tue, 22 Sep 2020 21:18:11 +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 291AB5DE86; Tue, 22 Sep 2020 21:18:10 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 03/14] qapi/doc.py: Add assertion on section.member Date: Tue, 22 Sep 2020 17:17:51 -0400 Message-Id: <20200922211802.4083666-4-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Similarly to other cases, we lack the power at the moment to express that a specific member is constrained to a certain containing type. Add an assertion before we use properties specific to that type. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 66333629d6..c645876b24 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -5,9 +5,10 @@ """This script produces the documentation of a qapi schema in texinfo format""" import re +from typing import Optional + from .gen import QAPIGenDoc -from .schema import QAPISchemaVisitor - +from .schema import QAPISchemaVisitor, QAPISchemaObjectTypeMember MSG_FMT = """ @deftypefn {type} {{}} {name} @@ -155,14 +156,17 @@ def texi_members(doc, what, base=None, variants=None, items = '' for section in doc.args.values(): # TODO Drop fallbacks when undocumented members are outlawed + desc: Optional[str] = None + if section.text: desc = texi_format(section.text) - elif (variants and variants.tag_member == section.member - and not section.member.type.doc_type()): - values = section.member.type.member_names() - members_text = ', '.join(['@t{"%s"}' % v for v in values]) - desc = 'One of ' + members_text + '\n' - else: + elif variants and variants.tag_member == section.member: + assert isinstance(section.member, QAPISchemaObjectTypeMember) + if not section.member.type.doc_type(): + values = section.member.type.member_names() + members_text = ', '.join(['@t{"%s"}' % v for v in values]) + desc = 'One of ' + members_text + '\n' + if desc is None: desc = 'Not documented\n' items += member_func(section.member, desc, '') From patchwork Tue Sep 22 21:17:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ACF1C4727D for ; Tue, 22 Sep 2020 21:42:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1D9C2371F for ; Tue, 22 Sep 2020 21:42:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="I/3KszU1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1D9C2371F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq2y-0004gS-En for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:42:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgG-0007eH-3o for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgE-0006em-7V for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809509; 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=+N9SVxzI3ShYNgvFdCqrNQXI9sy069vyoh7g1hqMmJc=; b=I/3KszU1IRdV8NVkccWu8K5ArFDoWFz5RdpfOZ8C1KAfBKTwd+CKcKOOrapBvpZeYkHJxZ WfMKtgtr8au9KaT2zyz31WdmSKNYx+EJDXIoxLO3mrLhXkGHYGRMBzUZj4NH+QF09zIX9f m/FPaQKTnxVYrFL9j55uy6OUkgTcQSs= 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-54-_l_knxG5OpS-cFYJ0bTo-w-1; Tue, 22 Sep 2020 17:18:13 -0400 X-MC-Unique: _l_knxG5OpS-cFYJ0bTo-w-1 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 2172880ED9A; Tue, 22 Sep 2020 21:18:12 +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 683555DE50; Tue, 22 Sep 2020 21:18:11 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 04/14] qapi/doc.py: assert correct types in member_func callbacks Date: Tue, 22 Sep 2020 17:17:52 -0400 Message-Id: <20200922211802.4083666-5-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" These each take a specific subtype; assert that they got that correct subtype. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index c645876b24..62b8f34707 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -8,7 +8,11 @@ from typing import Optional from .gen import QAPIGenDoc -from .schema import QAPISchemaVisitor, QAPISchemaObjectTypeMember +from .schema import ( + QAPISchemaEnumMember, + QAPISchemaObjectTypeMember, + QAPISchemaVisitor, +) MSG_FMT = """ @deftypefn {type} {{}} {name} @@ -136,12 +140,14 @@ def texi_if(ifcond, prefix='\n', suffix='\n'): def texi_enum_value(value, desc, suffix): """Format a table of members item for an enumeration value""" + assert isinstance(value, QAPISchemaEnumMember) return '@item @code{%s}\n%s%s' % ( value.name, desc, texi_if(value.ifcond, prefix='@*')) def texi_member(member, desc, suffix): """Format a table of members item for an object type member""" + assert isinstance(member, QAPISchemaObjectTypeMember) typ = member.type.doc_type() membertype = ': ' + typ if typ else '' return '@item @code{%s%s}%s%s\n%s%s' % ( From patchwork Tue Sep 22 21:17:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BD61C2D0E2 for ; Tue, 22 Sep 2020 22:00:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1CEB206B5 for ; Tue, 22 Sep 2020 22:00:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SYRanAzg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1CEB206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqKS-0003Sl-PI for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:00:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgG-0007gM-UD for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgF-0006ez-B3 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809510; 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=Z6p+MaHm4Qs8r5r17C9dR2iuLMyPT3Xy0fySuQF/DuI=; b=SYRanAzgDbf8+XNXnLbyNw9uVfK/BUKf2ldxYgfaQv6NSpnWjlqF1i2q1BMd2oQSUJcyup 9ArDUJT6FX0rxdFHsiUtsmGkNj+mlhx1T7zpldAS0Pz3GYEH+/d6tlZoH6AN6AArzIA/8x R2d7oJwzgavB7s1A01u5l03JyudK9HI= 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-225-lViz4IIENTCqzcgOTOHZLA-1; Tue, 22 Sep 2020 17:18:14 -0400 X-MC-Unique: lViz4IIENTCqzcgOTOHZLA-1 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 66A941084C80; Tue, 22 Sep 2020 21:18:13 +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 479BF5DE86; Tue, 22 Sep 2020 21:18:12 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 05/14] qapi/doc.py: Assert no suffix given for enum members Date: Tue, 22 Sep 2020 17:17:53 -0400 Message-Id: <20200922211802.4083666-6-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't do anything with this argument. If something shows up here, something wrong has happened. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 62b8f34707..9a02cf2f27 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -141,6 +141,7 @@ def texi_if(ifcond, prefix='\n', suffix='\n'): def texi_enum_value(value, desc, suffix): """Format a table of members item for an enumeration value""" assert isinstance(value, QAPISchemaEnumMember) + assert suffix == '', "Ignored suffix for texi_enum_value" return '@item @code{%s}\n%s%s' % ( value.name, desc, texi_if(value.ifcond, prefix='@*')) From patchwork Tue Sep 22 21:17:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F89CC2D0E2 for ; Tue, 22 Sep 2020 22:08:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7ED9208A9 for ; Tue, 22 Sep 2020 22:08:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IfvHJ+Qr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7ED9208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqSi-0004ej-Pc for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:08:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgI-0007ko-TQ for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46173) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgG-0006f7-KU for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809511; 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=vv6gz/rv2Yfhg2YZr9ebex9Kb/v+vSlxIvI5b/okvhU=; b=IfvHJ+QrP3E8YGj2GPtIKNXCyCnk5eevNI06NN1QtFRL0YqZ5x3fhIJ5WNx0njllKdZWL3 CJZku5bmEsmdKUiXhB7T9KdaAvYo4KEuz+vidAjCvrJRAwTXDDMXJEDPFIw66F3xrltl8i pkjFYE2jud5zTBM4KSbN6NRu2880WCg= 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-184--TR-ejU-NM2Encysz0fQmg-1; Tue, 22 Sep 2020 17:18:15 -0400 X-MC-Unique: -TR-ejU-NM2Encysz0fQmg-1 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 9B87D186DD39; Tue, 22 Sep 2020 21:18:14 +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 AEC765DE50; Tue, 22 Sep 2020 21:18:13 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 06/14] qapi/doc.py: Add type hint annotations Date: Tue, 22 Sep 2020 17:17:54 -0400 Message-Id: <20200922211802.4083666-7-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 119 ++++++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 32 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 9a02cf2f27..43943575da 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -5,14 +5,24 @@ """This script produces the documentation of a qapi schema in texinfo format""" import re -from typing import Optional +from typing import Callable, List, Optional from .gen import QAPIGenDoc +from .parser import QAPIDoc from .schema import ( + QAPISchema, + QAPISchemaEntity, QAPISchemaEnumMember, + QAPISchemaFeature, + QAPISchemaMember, + QAPISchemaObjectType, QAPISchemaObjectTypeMember, + QAPISchemaType, + QAPISchemaVariants, QAPISchemaVisitor, ) +from .source import QAPISourceInfo + MSG_FMT = """ @deftypefn {type} {{}} {name} @@ -36,27 +46,27 @@ """.format -def subst_strong(doc): +def subst_strong(doc: str) -> str: """Replaces *foo* by @strong{foo}""" return re.sub(r'\*([^*\n]+)\*', r'@strong{\1}', doc) -def subst_emph(doc): +def subst_emph(doc: str) -> str: """Replaces _foo_ by @emph{foo}""" return re.sub(r'\b_([^_\n]+)_\b', r'@emph{\1}', doc) -def subst_vars(doc): +def subst_vars(doc: str) -> str: """Replaces @var by @code{var}""" return re.sub(r'@([\w-]+)', r'@code{\1}', doc) -def subst_braces(doc): +def subst_braces(doc: str) -> str: """Replaces {} with @{ @}""" return doc.replace('{', '@{').replace('}', '@}') -def texi_example(doc): +def texi_example(doc: str) -> str: """Format @example""" # TODO: Neglects to escape @ characters. # We should probably escape them in subst_braces(), and rename the @@ -66,7 +76,7 @@ def texi_example(doc): return EXAMPLE_FMT(code=doc) -def texi_format(doc): +def texi_format(doc: str) -> str: """ Format documentation @@ -126,19 +136,26 @@ def texi_format(doc): return ret -def texi_body(doc): +def texi_body(doc: QAPIDoc) -> str: """Format the main documentation body""" return texi_format(doc.body.text) -def texi_if(ifcond, prefix='\n', suffix='\n'): +def texi_if(ifcond: Optional[List[str]], + prefix: str = '\n', + suffix: str = '\n') -> str: """Format the #if condition""" if not ifcond: return '' return '%s@b{If:} @code{%s}%s' % (prefix, ', '.join(ifcond), suffix) -def texi_enum_value(value, desc, suffix): +TexiMemberCallback = Callable[[QAPISchemaMember, str, str], str] + + +def texi_enum_value(value: QAPISchemaMember, + desc: str, + suffix: str) -> str: """Format a table of members item for an enumeration value""" assert isinstance(value, QAPISchemaEnumMember) assert suffix == '', "Ignored suffix for texi_enum_value" @@ -146,7 +163,9 @@ def texi_enum_value(value, desc, suffix): value.name, desc, texi_if(value.ifcond, prefix='@*')) -def texi_member(member, desc, suffix): +def texi_member(member: QAPISchemaMember, + desc: str, + suffix: str) -> str: """Format a table of members item for an object type member""" assert isinstance(member, QAPISchemaObjectTypeMember) typ = member.type.doc_type() @@ -157,8 +176,11 @@ def texi_member(member, desc, suffix): suffix, desc, texi_if(member.ifcond, prefix='@*')) -def texi_members(doc, what, base=None, variants=None, - member_func=texi_member): +def texi_members(doc: QAPIDoc, + what: str, + base: Optional[QAPISchemaObjectType] = None, + variants: Optional[QAPISchemaVariants] = None, + member_func: TexiMemberCallback = texi_member) -> str: """Format the table of members""" items = '' for section in doc.args.values(): @@ -195,7 +217,8 @@ def texi_members(doc, what, base=None, variants=None, return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items) -def texi_arguments(doc, boxed_arg_type): +def texi_arguments(doc: QAPIDoc, + boxed_arg_type: Optional[QAPISchemaObjectType]) -> str: if boxed_arg_type: assert not doc.args return ('\n@b{Arguments:} the members of @code{%s}\n' @@ -203,7 +226,7 @@ def texi_arguments(doc, boxed_arg_type): return texi_members(doc, 'Arguments') -def texi_features(doc): +def texi_features(doc: QAPIDoc) -> str: """Format the table of features""" items = '' for section in doc.features.values(): @@ -214,7 +237,7 @@ def texi_features(doc): return '\n@b{Features:}\n@table @asis\n%s@end table\n' % (items) -def texi_sections(doc, ifcond): +def texi_sections(doc: QAPIDoc, ifcond: Optional[List[str]]) -> str: """Format additional sections following arguments""" body = '' for section in doc.sections: @@ -229,7 +252,7 @@ def texi_sections(doc, ifcond): return body -def texi_type(typ, doc, ifcond, members): +def texi_type(typ: str, doc: QAPIDoc, ifcond: List[str], members: str) -> str: return TYPE_FMT(type=typ, name=doc.symbol, body=texi_body(doc), @@ -238,7 +261,7 @@ def texi_type(typ, doc, ifcond, members): sections=texi_sections(doc, ifcond)) -def texi_msg(typ, doc, ifcond, members): +def texi_msg(typ: str, doc: QAPIDoc, ifcond: List[str], members: str) -> str: return MSG_FMT(type=typ, name=doc.symbol, body=texi_body(doc), @@ -248,60 +271,92 @@ def texi_msg(typ, doc, ifcond, members): class QAPISchemaGenDocVisitor(QAPISchemaVisitor): - def __init__(self, prefix): + def __init__(self, prefix: str): self._prefix = prefix self._gen = QAPIGenDoc(self._prefix + 'qapi-doc.texi') - self.cur_doc = None + self.cur_doc: Optional[QAPIDoc] = None - def write(self, output_dir): + def write(self, output_dir: str) -> None: self._gen.write(output_dir) - def visit_enum_type(self, name, info, ifcond, features, members, prefix): + def visit_enum_type(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + members: List[QAPISchemaEnumMember], + prefix: Optional[str]) -> None: doc = self.cur_doc self._gen.add(texi_type('Enum', doc, ifcond, texi_members(doc, 'Values', member_func=texi_enum_value))) - def visit_object_type(self, name, info, ifcond, features, - base, members, variants): + def visit_object_type(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + base: Optional[QAPISchemaObjectType], + members: List[QAPISchemaObjectTypeMember], + variants: Optional[QAPISchemaVariants]) -> None: doc = self.cur_doc if base and base.is_implicit(): base = None self._gen.add(texi_type('Object', doc, ifcond, texi_members(doc, 'Members', base, variants))) - def visit_alternate_type(self, name, info, ifcond, features, variants): + def visit_alternate_type(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + variants: QAPISchemaVariants) -> None: doc = self.cur_doc self._gen.add(texi_type('Alternate', doc, ifcond, texi_members(doc, 'Members'))) - def visit_command(self, name, info, ifcond, features, - arg_type, ret_type, gen, success_response, boxed, - allow_oob, allow_preconfig): + def visit_command(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + arg_type: QAPISchemaObjectType, + ret_type: QAPISchemaType, + gen: bool, + success_response: bool, + boxed: bool, + allow_oob: bool, + allow_preconfig: bool) -> None: doc = self.cur_doc members = texi_arguments(doc, arg_type if boxed else None) self._gen.add(texi_msg('Command', doc, ifcond, members)) - def visit_event(self, name, info, ifcond, features, arg_type, boxed): + def visit_event(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + arg_type: QAPISchemaObjectType, + boxed: bool) -> None: doc = self.cur_doc members = texi_arguments(doc, arg_type if boxed else None) self._gen.add(texi_msg('Event', doc, ifcond, members)) - def symbol(self, doc, entity): + def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None: if self._gen._body: self._gen.add('\n') self.cur_doc = doc entity.visit(self) self.cur_doc = None - def freeform(self, doc): + def freeform(self, doc: QAPIDoc) -> None: assert not doc.args if self._gen._body: self._gen.add('\n') self._gen.add(texi_body(doc) + texi_sections(doc, None)) -def gen_doc(schema, output_dir, prefix): +def gen_doc(schema: QAPISchema, output_dir: str, prefix: str) -> None: vis = QAPISchemaGenDocVisitor(prefix) vis.visit_begin(schema) for doc in schema.docs: From patchwork Tue Sep 22 21:17:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC3C4C2D0E2 for ; Tue, 22 Sep 2020 21:36:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4223A20757 for ; Tue, 22 Sep 2020 21:36:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FeipoCoc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4223A20757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKpxK-0004TN-3d for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:36:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpg5-0007Dl-OA for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpg3-0006dM-Jb for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809498; 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=V088/OoVr6DOIKAPq2wN4A1alySPkWnFBRNJxm1t5dc=; b=FeipoCocYiHRgNEpfYaTk69VXyumaM6M0DACW6r7MHXlnQ/gUJYtmj0JHpzH4qXWXInCgg QckKttYyf9dw0I8h/EzN3mt1EAWWpihU5toD3SYCSvpFemg/fO6P7exfMZE9l43k6yw10d tIgmE4R2E5t9csnoKfr1jG3PCkIJsyM= 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-524-m1s1ew7aP3iKQRTp7lHXQQ-1; Tue, 22 Sep 2020 17:18:16 -0400 X-MC-Unique: m1s1ew7aP3iKQRTp7lHXQQ-1 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 A84C6801FD7; Tue, 22 Sep 2020 21:18:15 +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 C2EAC5DA7B; Tue, 22 Sep 2020 21:18:14 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 07/14] qapi/doc.py: enable mypy checks Date: Tue, 22 Sep 2020 17:17:55 -0400 Message-Id: <20200922211802.4083666-8-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/mypy.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index 0d0111930f..df9b05e4ab 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -4,11 +4,6 @@ strict_optional = False disallow_untyped_calls = False python_version = 3.6 -[mypy-qapi.doc] -disallow_subclassing_any = False -disallow_untyped_defs = False -disallow_incomplete_defs = False - [mypy-qapi.error] disallow_untyped_defs = False disallow_incomplete_defs = False From patchwork Tue Sep 22 21:17:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ADA4C2D0E2 for ; Tue, 22 Sep 2020 22:11:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01B7E208A9 for ; Tue, 22 Sep 2020 22:11:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DIAt0TlL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01B7E208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqV4-0006ea-7E for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:11:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgK-0007pS-QZ for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgI-0006fN-L3 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809513; 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=owOd+IHrwp7CTurkjFWXGVSBt7zqxNx6craqYA4lOD0=; b=DIAt0TlLw6/qVXE+Zpw9IZGfTJPTMxovB7WmIgVOEIA9sRfjzxb7KXdblr/dASf+U6+CWX 4G4Isj/4/CBDn+dp7exoBZFd+82M0ct3mdnYrnZdKQnBzaJN6symubm9LS7wgWjtllY8ON nhPBu/UmwcS8MY+ZzzYdvCAe1OioEzM= 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-588-LSDa1xIlPLGoj8MoFKo4LQ-1; Tue, 22 Sep 2020 17:18:17 -0400 X-MC-Unique: LSDa1xIlPLGoj8MoFKo4LQ-1 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 F1A9481CBE9; Tue, 22 Sep 2020 21:18:16 +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 E7D835DE50; Tue, 22 Sep 2020 21:18:15 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 08/14] qapi/doc.py: Add generic texi_member callback Date: Tue, 22 Sep 2020 17:17:56 -0400 Message-Id: <20200922211802.4083666-9-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We can just use the same callback and dispatch based on type, which removes the need to type the callback, add downcast assertions, or use less-specific types in the specialized generators. --- This patch is optional, it's just demonstrating a different way to handle the callback typing -- by eliminating the callback. Signed-off-by: John Snow --- scripts/qapi/doc.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 43943575da..74d017f60e 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -5,7 +5,7 @@ """This script produces the documentation of a qapi schema in texinfo format""" import re -from typing import Callable, List, Optional +from typing import List, Optional from .gen import QAPIGenDoc from .parser import QAPIDoc @@ -150,24 +150,17 @@ def texi_if(ifcond: Optional[List[str]], return '%s@b{If:} @code{%s}%s' % (prefix, ', '.join(ifcond), suffix) -TexiMemberCallback = Callable[[QAPISchemaMember, str, str], str] - - -def texi_enum_value(value: QAPISchemaMember, - desc: str, - suffix: str) -> str: +def texi_enum_value(value: QAPISchemaEnumMember, + desc: str, suffix: str) -> str: """Format a table of members item for an enumeration value""" - assert isinstance(value, QAPISchemaEnumMember) assert suffix == '', "Ignored suffix for texi_enum_value" return '@item @code{%s}\n%s%s' % ( value.name, desc, texi_if(value.ifcond, prefix='@*')) -def texi_member(member: QAPISchemaMember, - desc: str, - suffix: str) -> str: +def texi_object_member(member: QAPISchemaObjectTypeMember, + desc: str, suffix: str) -> str: """Format a table of members item for an object type member""" - assert isinstance(member, QAPISchemaObjectTypeMember) typ = member.type.doc_type() membertype = ': ' + typ if typ else '' return '@item @code{%s%s}%s%s\n%s%s' % ( @@ -176,11 +169,20 @@ def texi_member(member: QAPISchemaMember, suffix, desc, texi_if(member.ifcond, prefix='@*')) +def texi_member(member: QAPISchemaMember, desc: str, suffix: str) -> str: + """Format a table of members item for an arbitrary member type""" + + if isinstance(member, QAPISchemaObjectTypeMember): + return texi_object_member(member, desc, suffix) + if isinstance(member, QAPISchemaEnumMember): + return texi_enum_value(member, desc, suffix) + raise Exception(f"Unhandled member type {type(member).__name__}") + + def texi_members(doc: QAPIDoc, what: str, base: Optional[QAPISchemaObjectType] = None, - variants: Optional[QAPISchemaVariants] = None, - member_func: TexiMemberCallback = texi_member) -> str: + variants: Optional[QAPISchemaVariants] = None) -> str: """Format the table of members""" items = '' for section in doc.args.values(): @@ -198,7 +200,7 @@ def texi_members(doc: QAPIDoc, if desc is None: desc = 'Not documented\n' - items += member_func(section.member, desc, '') + items += texi_member(section.member, desc, '') if base: items += '@item The members of @code{%s}\n' % base.doc_type() if variants: @@ -208,7 +210,7 @@ def texi_members(doc: QAPIDoc, if v.type.is_implicit(): assert not v.type.base and not v.type.variants for m in v.type.local_members: - items += member_func(m, '', when) + items += texi_member(m, '', when) else: items += '@item The members of @code{%s}%s\n' % ( v.type.doc_type(), when) @@ -288,8 +290,7 @@ def visit_enum_type(self, prefix: Optional[str]) -> None: doc = self.cur_doc self._gen.add(texi_type('Enum', doc, ifcond, - texi_members(doc, 'Values', - member_func=texi_enum_value))) + texi_members(doc, 'Values'))) def visit_object_type(self, name: str, From patchwork Tue Sep 22 21:17:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273036 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3EEAC2D0E2 for ; Tue, 22 Sep 2020 21:44:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FA0A22262 for ; Tue, 22 Sep 2020 21:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GpyYOcpr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FA0A22262 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq5j-0008FR-Iq for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:44:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgK-0007ou-Gr for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:36 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55507 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 1kKpgI-0006fI-4j for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809513; 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=H43aEkn4ucruqYZhQ3PVuRfDgHbpJPGfshtNgSVV+is=; b=GpyYOcprQsCvBpGtM6Jzga80W4l7Qs7rHdhhm47FqcPj/YXCCUjujkMvG9/AP7eUqqJ5gm 9ZNfX+RUkuo7BhtXpgGKlvm6T5HIaz4ewtVIPwQusqtQ9wprik2XFGHrccHxli/sfQVny8 czjpICFQSJYSxjMRZADWzKqcnM3YEtI= 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-247-oWIjaINsNTqB744vVeJ_oA-1; Tue, 22 Sep 2020 17:18:19 -0400 X-MC-Unique: oWIjaINsNTqB744vVeJ_oA-1 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 5707B801FD7; Tue, 22 Sep 2020 21:18:18 +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 2504D5DE86; Tue, 22 Sep 2020 21:18:17 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 09/14] qapi/doc.py: Remove one-letter variables Date: Tue, 22 Sep 2020 17:17:57 -0400 Message-Id: <20200922211802.4083666-10-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 74d017f60e..5f2b0cd51d 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -203,17 +203,17 @@ def texi_members(doc: QAPIDoc, items += texi_member(section.member, desc, '') if base: items += '@item The members of @code{%s}\n' % base.doc_type() - if variants: - for v in variants.variants: - when = ' when @code{%s} is @t{"%s"}%s' % ( - variants.tag_member.name, v.name, texi_if(v.ifcond, " (", ")")) - if v.type.is_implicit(): - assert not v.type.base and not v.type.variants - for m in v.type.local_members: - items += texi_member(m, '', when) - else: - items += '@item The members of @code{%s}%s\n' % ( - v.type.doc_type(), when) + for variant in variants.variants if variants else (): + when = ' when @code{%s} is @t{"%s"}%s' % ( + variants.tag_member.name, variant.name, + texi_if(variant.ifcond, " (", ")")) + if variant.type.is_implicit(): + assert not variant.type.base and not variant.type.variants + for member in variant.type.local_members: + items += texi_member(member, '', when) + else: + items += '@item The members of @code{%s}%s\n' % ( + variant.type.doc_type(), when) if not items: return '' return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items) From patchwork Tue Sep 22 21:17:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D56C2D0E2 for ; Tue, 22 Sep 2020 22:04:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEE63206B5 for ; Tue, 22 Sep 2020 22:04:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UMtjxFp6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEE63206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqPC-00008x-5j for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:04:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpg8-0007MQ-Te for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45325) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpg7-0006dm-5h for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809502; 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=gFP2CDfnv5mGONcJkgdqHIpJD+65gzkUZZDABDlD0+Y=; b=UMtjxFp63CIak7fRH9Hjs1eTww3rNOLnnURh9nxFrFDB2U5lMlAv0J/Os1zEddAcrubPb2 W4MO/HCGAkrTrrWxmo9swrIC/HOensoUeV9YkN7XxV4sW1EpnECOMxrmh4SWkjRHTZxnXl zVcI/vxgiOaoWUu8GZk1lzSe4mmlxiY= 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-347-8YuupQF7OrSdgfERS7Bfng-1; Tue, 22 Sep 2020 17:18:20 -0400 X-MC-Unique: 8YuupQF7OrSdgfERS7Bfng-1 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 884C1186DD27; Tue, 22 Sep 2020 21:18:19 +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 99D965DE50; Tue, 22 Sep 2020 21:18:18 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 10/14] qapi/gen.py: Add __bool__ dunder method to QAPIGen Date: Tue, 22 Sep 2020 17:17:58 -0400 Message-Id: <20200922211802.4083666-11-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Falseish when there is no body or preamble; Trueish when there is. Header and footer are excluded for now, because they are assumed to be dynamic and always present. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/gen.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index ed498397ad..892d7d772e 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -40,6 +40,9 @@ def __init__(self, fname: Optional[str]): self._preamble = '' self._body = '' + def __bool__(self) -> bool: + return bool(self._preamble or self._body) + def preamble_add(self, text: str) -> None: self._preamble += text From patchwork Tue Sep 22 21:17:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67641C2D0E2 for ; Tue, 22 Sep 2020 22:06:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F026C208A9 for ; Tue, 22 Sep 2020 22:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HTi5a4JF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F026C208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqR3-0002IN-0g for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 18:06:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgD-0007WU-0r for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgB-0006eH-3A for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809506; 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=ebOceglSTdw4GEvJBey9gnPjX8dXLi8jeI5/H6dHIc8=; b=HTi5a4JFbVnKu9+WY1ZWVKQZX62P/2zxQi8cS5b64Vjs+Q6T5c2oOj2+5IzYxlsfEdaNSQ WXElc/oRySWOcrzTgw5UB0PGNyqOsnTIELLE83vMQIEYUausn3zvnVTtJyFC5T7Vfib3Q/ OTo2Vbip5e3MJkhZUzRCqq22KAqpy7U= 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-486-ZLPmkTHmOgqyJwScLfBRBA-1; Tue, 22 Sep 2020 17:18:22 -0400 X-MC-Unique: ZLPmkTHmOgqyJwScLfBRBA-1 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 1C69181CBEB; Tue, 22 Sep 2020 21:18: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 D42CD5DA7B; Tue, 22 Sep 2020 21:18:19 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 11/14] qapi/doc.py: Don't use private attributes of QAPIGen property Date: Tue, 22 Sep 2020 17:17:59 -0400 Message-Id: <20200922211802.4083666-12-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use the new __bool__ method to do the same without exposing the private attribute. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 5f2b0cd51d..2914e93b1c 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -344,7 +344,7 @@ def visit_event(self, self._gen.add(texi_msg('Event', doc, ifcond, members)) def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None: - if self._gen._body: + if self._gen: self._gen.add('\n') self.cur_doc = doc entity.visit(self) @@ -352,7 +352,7 @@ def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None: def freeform(self, doc: QAPIDoc) -> None: assert not doc.args - if self._gen._body: + if self._gen: self._gen.add('\n') self._gen.add(texi_body(doc) + texi_sections(doc, None)) From patchwork Tue Sep 22 21:18:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 273039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CF66C2D0E2 for ; Tue, 22 Sep 2020 21:39:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2E3822262 for ; Tue, 22 Sep 2020 21:39:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="atw3SFaM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2E3822262 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq03-0008C3-Hi for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:38:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgB-0007U4-VN for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:27 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:24260 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 1kKpgA-0006e7-7V for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809505; 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=2qYZeg0WoJ9N1k6SFDK8844HrRAj4Ho5LB+1Ts7rUPA=; b=atw3SFaMw8+au7Y5PMqIipCb62OcJkNAVYmwBzLFRUhhmQqfzNOYIbu1APCWPMxF5ac2yB O8aIF5ZI2QkdipbVLphFdLs21KhQPWAPoOduibKRyV3o3mrPS/yQWvqzceLhrRgce246Pu JIC9qiblq+ndRuBX5u/YwLHwjWKtiPU= 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-569--rau0TbyPBG6caQRIhOeMQ-1; Tue, 22 Sep 2020 17:18:23 -0400 X-MC-Unique: -rau0TbyPBG6caQRIhOeMQ-1 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 F398A802B70; Tue, 22 Sep 2020 21:18: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 434D05DE50; Tue, 22 Sep 2020 21:18:21 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 12/14] qapi/doc.py: Assert tag member is Enum type Date: Tue, 22 Sep 2020 17:18:00 -0400 Message-Id: <20200922211802.4083666-13-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The type system can't quite express this constraint natively: members can envelop any type -- but tag_members may only ever envelop an enumerated type. For now, shrug and add an assertion. Note: These assertions don't appear to be useful yet because schema.py is not yet typed. Once it is, these assertions will matter. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 2914e93b1c..b96d9046d3 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -13,6 +13,7 @@ QAPISchema, QAPISchemaEntity, QAPISchemaEnumMember, + QAPISchemaEnumType, QAPISchemaFeature, QAPISchemaMember, QAPISchemaObjectType, @@ -193,6 +194,7 @@ def texi_members(doc: QAPIDoc, desc = texi_format(section.text) elif variants and variants.tag_member == section.member: assert isinstance(section.member, QAPISchemaObjectTypeMember) + assert isinstance(section.member.type, QAPISchemaEnumType) if not section.member.type.doc_type(): values = section.member.type.member_names() members_text = ', '.join(['@t{"%s"}' % v for v in values]) From patchwork Tue Sep 22 21:18:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68D8EC2D0E2 for ; Tue, 22 Sep 2020 21:54:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03C5422262 for ; Tue, 22 Sep 2020 21:54:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="id3x6+Kf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03C5422262 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqEz-0005Zi-1k for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgC-0007WC-SP for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgA-0006eD-OH for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809506; 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=43bTF9s1dRQvu261U43X/7PVH8f8W3mJYCwEL5RBQDk=; b=id3x6+KfPZ16KtOjOkVGGL9I4uGMJkd20NiaMtPJ14rcpNSs2/xnZC+snQ6/zmjCbLOxd5 3PKNJmCGTTtUTM+oisZvkfPZfLJ0ynDqUKif0MgRudNRDCo5Rs9KV8+jURKGjoZqwPz3fW N+vpQVOh8JYHsbXBDssU0I0GznbMdrs= 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-591-GwQOHXWWOuy_VydmK4BCMw-1; Tue, 22 Sep 2020 17:18:24 -0400 X-MC-Unique: GwQOHXWWOuy_VydmK4BCMw-1 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 16D9357056; Tue, 22 Sep 2020 21:18: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 27A7F5DE86; Tue, 22 Sep 2020 21:18:22 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 13/14] qapi/doc.py: Assert type of object variant Date: Tue, 22 Sep 2020 17:18:01 -0400 Message-Id: <20200922211802.4083666-14-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Objects may have variants, but those variants must themselves be objects. This is difficult to express with our current type system and hierarchy, so instead pepper in an assertion. Note: These assertions don't appear to be useful yet because schema.py is not yet typed. Once it is, these assertions will matter. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost --- scripts/qapi/doc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index b96d9046d3..3de592e220 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -206,6 +206,7 @@ def texi_members(doc: QAPIDoc, if base: items += '@item The members of @code{%s}\n' % base.doc_type() for variant in variants.variants if variants else (): + assert isinstance(variant.type, QAPISchemaObjectType) when = ' when @code{%s} is @t{"%s"}%s' % ( variants.tag_member.name, variant.name, texi_if(variant.ifcond, " (", ")")) From patchwork Tue Sep 22 21:18:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 304704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B45C2D0E2 for ; Tue, 22 Sep 2020 21:57:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD00D206B5 for ; Tue, 22 Sep 2020 21:57:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KhAOPqyd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD00D206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqIJ-0000VO-NB for qemu-devel@archiver.kernel.org; Tue, 22 Sep 2020 17:57:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKpgE-0007ZC-5I for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKpgC-0006eY-FW for qemu-devel@nongnu.org; Tue, 22 Sep 2020 17:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600809507; 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=wLtuOYGmP4PpgM90n9U72U7fhjJLXm76tKv3IJ2+Wvk=; b=KhAOPqydsaOhe05wbDHQyJ8FzVp3OzMulA8k0Elyg5OwnE1jsUExmO8ia2o3oH933eyU++ AzmWaALkX9RVIlldDszx/jq0d0L5cKs0n4NyAwL5Tx5c9HyqhwbmSZfahHLs+yaY/1+kHV P+YFdJbg1+ASheYk1fqAXcH3QhtY/gs= 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-296-KQ_hV1SROHWYuX4x3SHL6A-1; Tue, 22 Sep 2020 17:18:25 -0400 X-MC-Unique: KQ_hV1SROHWYuX4x3SHL6A-1 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 9935B84635D; Tue, 22 Sep 2020 21:18: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 5C4385DE50; Tue, 22 Sep 2020 21:18:23 +0000 (UTC) From: John Snow To: Markus Armbruster Subject: [PATCH 14/14] qapi/doc.py: enable pylint checks Date: Tue, 22 Sep 2020 17:18:02 -0400 Message-Id: <20200922211802.4083666-15-jsnow@redhat.com> In-Reply-To: <20200922211802.4083666-1-jsnow@redhat.com> References: <20200922211802.4083666-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 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: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: John Snow Tested-by: Eduardo Habkost Reviewed-by: Eduardo Habkost --- scripts/qapi/pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index d7adb2ba33..fb0386d529 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -2,8 +2,7 @@ # Add files or directories matching the regex patterns to the ignore list. # The regex matches against base names, not paths. -ignore-patterns=doc.py, - error.py, +ignore-patterns=error.py, parser.py, schema.py,