From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600810219; cv=none; d=zohomail.com; s=zohoarc; b=K2a3pQB64q5Pwuj4O7RgofA8kLluRSqJCYZCWqC9h428EkRBNrrCu05RUE/SAHo5wZHXUDUH7eU9kc17sYL38U6qgSlkTtXiLtNnsfS8TxpT9xSHv4Yx54mX9OGHaCMphwjFKg39/9Ms/l3mIXsP4xpcpk4mxj26TSdq7i0vAno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600810219; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RTDJzHDAZhCV6t90+MnWXmSr5yYGkuEX4Vl4khiBUxA=; b=jHGxfH/HlEC0LMzM0Jh8hRleJ9U4DOvwuZbyoAC+s6lO/xULNyShmTXFySFDIUatl2/3JM1s46cy9jsC0w4UVre3pThi6tLnZOvZhLPu/LYkgHSuQUQScYDzk702GimX8kl+ETFmV2jWCq4ajD0jg7try2llvOJP8R/oX4uJEEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600810219706342.16525186458; Tue, 22 Sep 2020 14:30:19 -0700 (PDT) Received: from localhost ([::1]:60796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKprc-0005P1-LI for importer@patchew.org; Tue, 22 Sep 2020 17:30:18 -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 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 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) 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= X-MC-Unique: 4fTgJ8i7M1SXiLk4lbtqog-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 =3D self.cur_doc - self._gen.add(texi_msg('Command', doc, ifcond, - texi_arguments(doc, - arg_type if boxed else None)= )) + members =3D texi_arguments(doc, arg_type if boxed else None) + self._gen.add(texi_msg('Command', doc, ifcond, members)) =20 def visit_event(self, name, info, ifcond, features, arg_type, boxed): doc =3D self.cur_doc - self._gen.add(texi_msg('Event', doc, ifcond, - texi_arguments(doc, - arg_type if boxed else None)= )) + members =3D texi_arguments(doc, arg_type if boxed else None) + self._gen.add(texi_msg('Event', doc, ifcond, members)) =20 def symbol(self, doc, entity): if self._gen._body: --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600810433; cv=none; d=zohomail.com; s=zohoarc; b=RDTz7Ttp63Q4WqFcTGcii3eJtl1FOdnN9/S+w6yRb7Vfp8kxwxcH5OrP6IIgsR9YnVT2ayD8aw6OI6nYlVAWq+Hb8Joez1bS6trHuduek0FqpsQ2/hBJDV9dE+WeW+pOP3/iHsp+KRLwZDF2xjV04YV8jsBPyEj+RkLwCUXz1ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600810433; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b74oJYdLoSfqHVygXt9kzKk9vHZ6c5Y1WDerG8Zn2u0=; b=i6Ew88OwxJYGa5Vi1x3UBiN6REt0bC4yTNiDc04gPjI1IpFlCIeRW47EAo0wlxR/jfB23i2/VwNaMIJNktSJiNjy42Q9P4ff1t1IKjbnnHef3u92LRNub7QZQbrzV7ocECowYi+hIS/uJdC9+OotPOifXPKZZqiNEY0fr47aHZ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600810433777198.68048944638122; Tue, 22 Sep 2020 14:33:53 -0700 (PDT) Received: from localhost ([::1]:40618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKpv6-0000lW-9l for importer@patchew.org; Tue, 22 Sep 2020 17:33:52 -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 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 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) 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= X-MC-Unique: PJ5FyfKQNcSybBGAgJwCtw-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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=3DNone, variants=3DNon= e, desc =3D 'One of ' + members_text + '\n' else: desc =3D 'Not documented\n' - items +=3D member_func(section.member, desc, suffix=3D'') + + items +=3D member_func(section.member, desc, '') if base: items +=3D '@item The members of @code{%s}\n' % base.doc_type() if variants: @@ -174,7 +175,7 @@ def texi_members(doc, what, base=3DNone, variants=3DNon= e, if v.type.is_implicit(): assert not v.type.base and not v.type.variants for m in v.type.local_members: - items +=3D member_func(m, desc=3D'', suffix=3Dwhen) + items +=3D member_func(m, '', when) else: items +=3D '@item The members of @code{%s}%s\n' % ( v.type.doc_type(), when) --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812221; cv=none; d=zohomail.com; s=zohoarc; b=IUPFmIh4hf+iJYqkmvkEsvfVEvh1rcBcLav0i+zumV3OwzTM68Grh5pFnWpw7D3Z9Ow5U1W5SfpCQ+iUIt+o4QC4incbrpRXclmiginJkCO9CGuiQ6eFGJkT608b9PaDofpYOmYWW5vNzjR89qtYOFhYWQhuZgjrI+bjlrtd6CQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812221; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xN0yCdGye3vtSXNKYYdrnPY6HLeoGgrhJUfZGcNxYxQ=; b=EHJRh7cM7VTc776JMrXTCLRGY3aFd1s0megkP9envEIj/cEKcxlLfYuDCtjAEm/JhqgkPP2kUuhhrAg5Zqp87CedX+Nze2D3ZcaBhW1fZXJdogPY8w/Ilvoqt5/3ngnQvbCVKRSMFWmE8/F2VtCNiLJs4c1KPUaJmowDbOyyVkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812221050650.4238064678101; Tue, 22 Sep 2020 15:03:41 -0700 (PDT) Received: from localhost ([::1]:48344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqNv-0006jI-NS for importer@patchew.org; Tue, 22 Sep 2020 18:03:39 -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 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 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) 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= X-MC-Unique: Ct17_QhrPXu0Bubig_LNRg-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 form= at""" =20 import re +from typing import Optional + from .gen import QAPIGenDoc -from .schema import QAPISchemaVisitor - +from .schema import QAPISchemaVisitor, QAPISchemaObjectTypeMember =20 MSG_FMT =3D """ @deftypefn {type} {{}} {name} @@ -155,14 +156,17 @@ def texi_members(doc, what, base=3DNone, variants=3DN= one, items =3D '' for section in doc.args.values(): # TODO Drop fallbacks when undocumented members are outlawed + desc: Optional[str] =3D None + if section.text: desc =3D texi_format(section.text) - elif (variants and variants.tag_member =3D=3D section.member - and not section.member.type.doc_type()): - values =3D section.member.type.member_names() - members_text =3D ', '.join(['@t{"%s"}' % v for v in values]) - desc =3D 'One of ' + members_text + '\n' - else: + elif variants and variants.tag_member =3D=3D section.member: + assert isinstance(section.member, QAPISchemaObjectTypeMember) + if not section.member.type.doc_type(): + values =3D section.member.type.member_names() + members_text =3D ', '.join(['@t{"%s"}' % v for v in values= ]) + desc =3D 'One of ' + members_text + '\n' + if desc is None: desc =3D 'Not documented\n' =20 items +=3D member_func(section.member, desc, '') --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600810925; cv=none; d=zohomail.com; s=zohoarc; b=gEDFNBtODgZYE4m9zZMuDVbyNcCq4CU2OSuqWtigxYewnE+UNG2lSbepPLKSLTIUfZF+Fdqjvq5ZKQp6I3S1Za1sXsjbL6eZZZfFg4kygvQ9zGMJVPOEuP07Vl3cNajW9ZgrooTtN627XtfQWRjlM5OIekGikXElFdIx90KDQ+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600810925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+N9SVxzI3ShYNgvFdCqrNQXI9sy069vyoh7g1hqMmJc=; b=Mf8jbMqkqsC2QwHEtaw+GyJjXAIrXthAcaTbu/Si9sExc9BdqPdC/7uHTktLUs2de2UdCf1oYFL9q7Aj9pT4kEJjmNN0DvGtdQTDmsE+cG+5zeiHIZMGyOPK00aoVfiEj1NJ9tt47R+/aljE0X00I0d9yE8NY9BsX+buxImFyjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600810925893343.5398490765838; Tue, 22 Sep 2020 14:42:05 -0700 (PDT) Received: from localhost ([::1]:39764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq32-0004gS-H7 for importer@patchew.org; Tue, 22 Sep 2020 17:42:04 -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 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 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) 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= X-MC-Unique: _l_knxG5OpS-cFYJ0bTo-w-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" These each take a specific subtype; assert that they got that correct subtype. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 =20 from .gen import QAPIGenDoc -from .schema import QAPISchemaVisitor, QAPISchemaObjectTypeMember +from .schema import ( + QAPISchemaEnumMember, + QAPISchemaObjectTypeMember, + QAPISchemaVisitor, +) =20 MSG_FMT =3D """ @deftypefn {type} {{}} {name} @@ -136,12 +140,14 @@ def texi_if(ifcond, prefix=3D'\n', suffix=3D'\n'): =20 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=3D'@*')) =20 =20 def texi_member(member, desc, suffix): """Format a table of members item for an object type member""" + assert isinstance(member, QAPISchemaObjectTypeMember) typ =3D member.type.doc_type() membertype =3D ': ' + typ if typ else '' return '@item @code{%s%s}%s%s\n%s%s' % ( --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812020; cv=none; d=zohomail.com; s=zohoarc; b=ec5KxyDTq0wTpUD3jBBYvfVLcYDGzIQPaF5q1F+hrbseVKamzRVVJ11Zv1seDuNEX8uTxV2WMdgKyG0uT0JxnJh81tgNgpVs8RXx0Ug+MYZ9GqnWHJ45r3aP95RHLMVt4Oh59Q9VTDrancuxUyL7FrgyISPT7XUNeLbYp39HUkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812020; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z6p+MaHm4Qs8r5r17C9dR2iuLMyPT3Xy0fySuQF/DuI=; b=l4NtnQ87M8l6c3Ss+u35ootjiwG9ZbPIvqw8YxzH+DKDsQMoRBGlds0z3JI4lz8rBg2fJXJy02pOt2YFMwE94IpqImd0mWMf7KGiKnHovmvbI7hf9iVaPcf0D9g0br67eiK44a/u3p76f55juTCI7dvy4Xm5n9w7OxMHHSqxjC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812020799535.9491778557447; Tue, 22 Sep 2020 15:00:20 -0700 (PDT) Received: from localhost ([::1]:40926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqKh-0003Sl-H9 for importer@patchew.org; Tue, 22 Sep 2020 18:00:19 -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 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 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) 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= X-MC-Unique: lViz4IIENTCqzcgOTOHZLA-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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=3D'\n', suffix=3D'\n'): def texi_enum_value(value, desc, suffix): """Format a table of members item for an enumeration value""" assert isinstance(value, QAPISchemaEnumMember) + assert suffix =3D=3D '', "Ignored suffix for texi_enum_value" return '@item @code{%s}\n%s%s' % ( value.name, desc, texi_if(value.ifcond, prefix=3D'@*')) =20 --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812525; cv=none; d=zohomail.com; s=zohoarc; b=I+kSyj/hN5xWkMZhHpxPRPwDhQbOtQQS75K3+hHcSSl7x8NSFvW+26lnuvkt+PGSk4bXflGXx3PkYmCzyLNKUpnSAC7uOFfVg8+7wfGMEK3n4OWMP7YVMmH5U6hKWVEf/+/hU4kBvn1zupTM2iAkVCs3D6Fh2ZVopikZb5pyPJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812525; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vv6gz/rv2Yfhg2YZr9ebex9Kb/v+vSlxIvI5b/okvhU=; b=LCfJECwPBraLUyk4XRasaei3PCoZkxGFzjpjY4f1+zMotBwbX7ldrIlG34550B9UOaJ9meX9f+uDZP3VSq0FIj5ErNMl+UUJh+M84QkPBI4OMzhnQB1gPRTdN7Eh46pJTozxto8dzBkngzbqxFrsbegQvzVwm0fD47fr5KE6b9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16008125255741020.8037092315227; Tue, 22 Sep 2020 15:08:45 -0700 (PDT) Received: from localhost ([::1]:35558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqSp-0004ej-UC for importer@patchew.org; Tue, 22 Sep 2020 18:08:43 -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 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 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) 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= X-MC-Unique: -TR-ejU-NM2Encysz0fQmg-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 form= at""" =20 import re -from typing import Optional +from typing import Callable, List, Optional =20 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 + =20 MSG_FMT =3D """ @deftypefn {type} {{}} {name} @@ -36,27 +46,27 @@ """.format =20 =20 -def subst_strong(doc): +def subst_strong(doc: str) -> str: """Replaces *foo* by @strong{foo}""" return re.sub(r'\*([^*\n]+)\*', r'@strong{\1}', doc) =20 =20 -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) =20 =20 -def subst_vars(doc): +def subst_vars(doc: str) -> str: """Replaces @var by @code{var}""" return re.sub(r'@([\w-]+)', r'@code{\1}', doc) =20 =20 -def subst_braces(doc): +def subst_braces(doc: str) -> str: """Replaces {} with @{ @}""" return doc.replace('{', '@{').replace('}', '@}') =20 =20 -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=3Ddoc) =20 =20 -def texi_format(doc): +def texi_format(doc: str) -> str: """ Format documentation =20 @@ -126,19 +136,26 @@ def texi_format(doc): return ret =20 =20 -def texi_body(doc): +def texi_body(doc: QAPIDoc) -> str: """Format the main documentation body""" return texi_format(doc.body.text) =20 =20 -def texi_if(ifcond, prefix=3D'\n', suffix=3D'\n'): +def texi_if(ifcond: Optional[List[str]], + prefix: str =3D '\n', + suffix: str =3D '\n') -> str: """Format the #if condition""" if not ifcond: return '' return '%s@b{If:} @code{%s}%s' % (prefix, ', '.join(ifcond), suffix) =20 =20 -def texi_enum_value(value, desc, suffix): +TexiMemberCallback =3D 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 =3D=3D '', "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=3D'@*')) =20 =20 -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 =3D member.type.doc_type() @@ -157,8 +176,11 @@ def texi_member(member, desc, suffix): suffix, desc, texi_if(member.ifcond, prefix=3D'@*')) =20 =20 -def texi_members(doc, what, base=3DNone, variants=3DNone, - member_func=3Dtexi_member): +def texi_members(doc: QAPIDoc, + what: str, + base: Optional[QAPISchemaObjectType] =3D None, + variants: Optional[QAPISchemaVariants] =3D None, + member_func: TexiMemberCallback =3D texi_member) -> str: """Format the table of members""" items =3D '' for section in doc.args.values(): @@ -195,7 +217,8 @@ def texi_members(doc, what, base=3DNone, variants=3DNon= e, return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items) =20 =20 -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') =20 =20 -def texi_features(doc): +def texi_features(doc: QAPIDoc) -> str: """Format the table of features""" items =3D '' 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) =20 =20 -def texi_sections(doc, ifcond): +def texi_sections(doc: QAPIDoc, ifcond: Optional[List[str]]) -> str: """Format additional sections following arguments""" body =3D '' for section in doc.sections: @@ -229,7 +252,7 @@ def texi_sections(doc, ifcond): return body =20 =20 -def texi_type(typ, doc, ifcond, members): +def texi_type(typ: str, doc: QAPIDoc, ifcond: List[str], members: str) -> = str: return TYPE_FMT(type=3Dtyp, name=3Ddoc.symbol, body=3Dtexi_body(doc), @@ -238,7 +261,7 @@ def texi_type(typ, doc, ifcond, members): sections=3Dtexi_sections(doc, ifcond)) =20 =20 -def texi_msg(typ, doc, ifcond, members): +def texi_msg(typ: str, doc: QAPIDoc, ifcond: List[str], members: str) -> s= tr: return MSG_FMT(type=3Dtyp, name=3Ddoc.symbol, body=3Dtexi_body(doc), @@ -248,60 +271,92 @@ def texi_msg(typ, doc, ifcond, members): =20 =20 class QAPISchemaGenDocVisitor(QAPISchemaVisitor): - def __init__(self, prefix): + def __init__(self, prefix: str): self._prefix =3D prefix self._gen =3D QAPIGenDoc(self._prefix + 'qapi-doc.texi') - self.cur_doc =3D None + self.cur_doc: Optional[QAPIDoc] =3D None =20 - def write(self, output_dir): + def write(self, output_dir: str) -> None: self._gen.write(output_dir) =20 - def visit_enum_type(self, name, info, ifcond, features, members, prefi= x): + def visit_enum_type(self, + name: str, + info: QAPISourceInfo, + ifcond: List[str], + features: List[QAPISchemaFeature], + members: List[QAPISchemaEnumMember], + prefix: Optional[str]) -> None: doc =3D self.cur_doc self._gen.add(texi_type('Enum', doc, ifcond, texi_members(doc, 'Values', member_func=3Dtexi_enum_value= ))) =20 - 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 =3D self.cur_doc if base and base.is_implicit(): base =3D None self._gen.add(texi_type('Object', doc, ifcond, texi_members(doc, 'Members', base, variant= s))) =20 - 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 =3D self.cur_doc self._gen.add(texi_type('Alternate', doc, ifcond, texi_members(doc, 'Members'))) =20 - 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 =3D self.cur_doc members =3D texi_arguments(doc, arg_type if boxed else None) self._gen.add(texi_msg('Command', doc, ifcond, members)) =20 - 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 =3D self.cur_doc members =3D texi_arguments(doc, arg_type if boxed else None) self._gen.add(texi_msg('Event', doc, ifcond, members)) =20 - def symbol(self, doc, entity): + def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None: if self._gen._body: self._gen.add('\n') self.cur_doc =3D doc entity.visit(self) self.cur_doc =3D None =20 - 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)) =20 =20 -def gen_doc(schema, output_dir, prefix): +def gen_doc(schema: QAPISchema, output_dir: str, prefix: str) -> None: vis =3D QAPISchemaGenDocVisitor(prefix) vis.visit_begin(schema) for doc in schema.docs: --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600810592; cv=none; d=zohomail.com; s=zohoarc; b=g1QJYjth+X8Lq7XchLpVhfb7NlzkdOHWZPsi/6xALHVBFdJLRrxR5CUaoo2zQ/14zDkAmdeYM/8ZcnOJOTKdyIR4mvz2fOjMyGi/S7I1EioYstLkOY9Zp8gSqQBnLuDe5LvTcLvjbwobaKNs5JSTGEJ+UuTKWWuuuAnxSKnHJj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600810592; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V088/OoVr6DOIKAPq2wN4A1alySPkWnFBRNJxm1t5dc=; b=VztYdpa1xd8IvHm1lkiAYsun7RCYte30Aj+Pmi+Eiy/qR2PqN8g/bvjo3v95/8D2y3xQUtbvEJly43SxruHqgqIR1+HVbhjG8OLQfHX84sh/GObpvdkRaIWq0VQ91TXzcSj77uiq/vjyKCDM1eimF5KQFX67D0QqCUp7nZqiEuA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600810592808128.03888484123945; Tue, 22 Sep 2020 14:36:32 -0700 (PDT) Received: from localhost ([::1]:48866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKpxf-0004TN-9O for importer@patchew.org; Tue, 22 Sep 2020 17:36:31 -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 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 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) 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= X-MC-Unique: m1s1ew7aP3iKQRTp7lHXQQ-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- scripts/qapi/mypy.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index 0d0111930f..df9b05e4ab 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -4,11 +4,6 @@ strict_optional =3D False disallow_untyped_calls =3D False python_version =3D 3.6 =20 -[mypy-qapi.doc] -disallow_subclassing_any =3D False -disallow_untyped_defs =3D False -disallow_incomplete_defs =3D False - [mypy-qapi.error] disallow_untyped_defs =3D False disallow_incomplete_defs =3D False --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812671; cv=none; d=zohomail.com; s=zohoarc; b=l3BNYbqiRyoEoCsk2kuZYVxuvDQG7FjRyfwyNwmlDdi4PMv24+cpjxHUkh62ppFCePbR2BX+b7Hd4KReRWeU/Wl0SJTUxizP5bvkAHpIqreT0l9k6BjKvuc5ic2lZ35YP3KPkzvP9z0/fKemrDZ1cFdjyGX4fJuhbxj4nCv5nRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812671; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=owOd+IHrwp7CTurkjFWXGVSBt7zqxNx6craqYA4lOD0=; b=ll4vYex0uJhLCeGKlDsOaVIDJcjs4gejTiZA+eY4rMhOPQbx3BMy3og2YzYsK/O/VvC4KmnSNsunN9Tz/LGi2LfRniX+iUJ2dGt7ldo43fMpHh38MioYEyvY1664eXk6AciEJb2GrhYGwbO/FJugDpVCzY/qVJamB9m71o14G1I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812671983876.1389071932052; Tue, 22 Sep 2020 15:11:11 -0700 (PDT) Received: from localhost ([::1]:40222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqVC-0006ea-JC for importer@patchew.org; Tue, 22 Sep 2020 18:11:10 -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 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 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) 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= X-MC-Unique: LSDa1xIlPLGoj8MoFKo4LQ-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We 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. based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 form= at""" =20 import re -from typing import Callable, List, Optional +from typing import List, Optional =20 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) =20 =20 -TexiMemberCallback =3D 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 =3D=3D '', "Ignored suffix for texi_enum_value" return '@item @code{%s}\n%s%s' % ( value.name, desc, texi_if(value.ifcond, prefix=3D'@*')) =20 =20 -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 =3D member.type.doc_type() membertype =3D ': ' + 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=3D'@*')) =20 =20 +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] =3D None, - variants: Optional[QAPISchemaVariants] =3D None, - member_func: TexiMemberCallback =3D texi_member) -> str: + variants: Optional[QAPISchemaVariants] =3D None) -> str: """Format the table of members""" items =3D '' for section in doc.args.values(): @@ -198,7 +200,7 @@ def texi_members(doc: QAPIDoc, if desc is None: desc =3D 'Not documented\n' =20 - items +=3D member_func(section.member, desc, '') + items +=3D texi_member(section.member, desc, '') if base: items +=3D '@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 +=3D member_func(m, '', when) + items +=3D texi_member(m, '', when) else: items +=3D '@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 =3D self.cur_doc self._gen.add(texi_type('Enum', doc, ifcond, - texi_members(doc, 'Values', - member_func=3Dtexi_enum_value= ))) + texi_members(doc, 'Values'))) =20 def visit_object_type(self, name: str, --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600811096; cv=none; d=zohomail.com; s=zohoarc; b=V5T46oXaPI//HG1VpJUKmHW8nL1+QoEo7Zb6GGFfqPsyXoG0yorhJpr4SIQUbjGhjqUdmIAQUty+GnlvPFMmfEL9HG97oNMOjIqiu/rlaILqIjkdU0QicaGd7nvCfpU1UZpZ6V4fBpfx+XOrXfApWL6T2ixlFREgNBnS/+ke4Wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600811096; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H43aEkn4ucruqYZhQ3PVuRfDgHbpJPGfshtNgSVV+is=; b=PkDaFAXMJp3uiRpTZUL5dDiQhEiW4ahLvpVQQmjML9RdmJF32XXPTHl6Y1rcONUtVzNHEOEoxMuvwLx2XK6qVlqVBQ23t2yX0LaC3jzRLvkUNIt0wIUePCdQsIRwawRHnsRrAd8AIOEliGp23Jbv6Zr58QliII1TlZLhFWeduRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600811096746995.1063073958909; Tue, 22 Sep 2020 14:44:56 -0700 (PDT) Received: from localhost ([::1]:48200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq5n-0008FR-7D for importer@patchew.org; Tue, 22 Sep 2020 17:44:55 -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 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 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) 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= X-MC-Unique: oWIjaINsNTqB744vVeJ_oA-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 17:01:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 +=3D texi_member(section.member, desc, '') if base: items +=3D '@item The members of @code{%s}\n' % base.doc_type() - if variants: - for v in variants.variants: - when =3D ' 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 +=3D texi_member(m, '', when) - else: - items +=3D '@item The members of @code{%s}%s\n' % ( - v.type.doc_type(), when) + for variant in variants.variants if variants else (): + when =3D ' 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 +=3D texi_member(member, '', when) + else: + items +=3D '@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) --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812302; cv=none; d=zohomail.com; s=zohoarc; b=Sz/OUC5iLrYdozi+PzD6Fij9uTjUnU/7b4D2J5Xo1tVDVjdHXUbVJ7hRPYrBxBg22ifESLj4K9FPYPx6aWhFXPO8YWKrons+gTLhicJclNFI2l4NCGaB5C1FXdE/sm2ABD9IifB8LF9JmHJd3NJFM+TO5WbP/coTJCAQhfr8Y7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812302; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gFP2CDfnv5mGONcJkgdqHIpJD+65gzkUZZDABDlD0+Y=; b=egje/yAr6axi5gyLzxKA9Sgn8SF7IQCgk6Vmqw9alQ/2IrWywcxP565ZF8ldzmXr4PuTSU79Qb2XYlxJ7e89QJE9pItKsJux7SIDrkiPnN+HcX93mam6rdRBevatFvx9orLrQbxHmHDfNg1Uz6+Qs2SAHZ+d6Wx4Hgtm+RMrX38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812302697427.7875026015588; Tue, 22 Sep 2020 15:05:02 -0700 (PDT) Received: from localhost ([::1]:52906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqPF-00008x-5h for importer@patchew.org; Tue, 22 Sep 2020 18:05:01 -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 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 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) 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= X-MC-Unique: 8YuupQF7OrSdgfERS7Bfng-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 =3D '' self._body =3D '' =20 + def __bool__(self) -> bool: + return bool(self._preamble or self._body) + def preamble_add(self, text: str) -> None: self._preamble +=3D text =20 --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600812417; cv=none; d=zohomail.com; s=zohoarc; b=FSNBo1BXSjcyPZd/wdD4HSUI26hg9Js6c9DFf9cnI7zNCp+668gsBpxM0qIp+GGlXlQYr3YqrVMj/hAiwmI4n7wu+l1aKuqbrjHWFlcKeNTqpbKOrdeBECFtO+bewm0c8TXjAGpw175t787J/fJ09VN5ahwy5e0XeAwQEiaPrB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600812417; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ebOceglSTdw4GEvJBey9gnPjX8dXLi8jeI5/H6dHIc8=; b=Q23VeBAqEDFH/IuQRAMpdfiXIZrow4+28pTGK56H6vIZShpE6ILDpqQTWpwWeFEbCfSMPVjODtRLRjEhUD9hLLmpVJ47QuG7mGIdyPYoICYWb5HPobgmJpU+cZQG/+KHCwTdK+WLrhS6+SFa62STXP8GucAhsE/SdeoGMTapiTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600812417647582.2214758416047; Tue, 22 Sep 2020 15:06:57 -0700 (PDT) Received: from localhost ([::1]:57954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqR6-0002IN-7f for importer@patchew.org; Tue, 22 Sep 2020 18:06:56 -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 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 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) 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= X-MC-Unique: ZLPmkTHmOgqyJwScLfBRBA-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use the new __bool__ method to do the same without exposing the private attribute. Signed-off-by: John Snow Reviewed-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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)) =20 def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None: - if self._gen._body: + if self._gen: self._gen.add('\n') self.cur_doc =3D doc entity.visit(self) @@ -352,7 +352,7 @@ def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity= ) -> None: =20 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)) =20 --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600810745; cv=none; d=zohomail.com; s=zohoarc; b=M7zc08ibczV0+G1IwCHBZLxRPFev6ThzJjdHJGatZP+HgbU3MH2AKn8B3z4LLAAreDRQVG3K/w7S5HftiCW4y+T7gJkVbjWcLoMxsS2MP6XQysL3YCzq/KJ7L0HXubxdtSCauP2OEfGDyrfYgoxf2ldCffUvp//HMG0FQdq17+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600810745; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2qYZeg0WoJ9N1k6SFDK8844HrRAj4Ho5LB+1Ts7rUPA=; b=jtlbRcPbGkFh0rs1tM7UHHJeNxqiNJUHG5bDpGfSoVC0FO1tqLtCdZ9GzM5216guOcOkwa0rW0xGTl0ofYYEx2cK3jQVlhfMf9XAhmAWdeD5sff5l7EgfhfL5eQYsx0GpEN/Q++Ecg4YJnqhlaq/BWnKGNI5SAeLOoeEIU+ibM4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600810745043258.715689868274; Tue, 22 Sep 2020 14:39:05 -0700 (PDT) Received: from localhost ([::1]:56996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKq07-0008C3-KM for importer@patchew.org; Tue, 22 Sep 2020 17:39:03 -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 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 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) 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= X-MC-Unique: -rau0TbyPBG6caQRIhOeMQ-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 17:01:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 =3D texi_format(section.text) elif variants and variants.tag_member =3D=3D section.member: assert isinstance(section.member, QAPISchemaObjectTypeMember) + assert isinstance(section.member.type, QAPISchemaEnumType) if not section.member.type.doc_type(): values =3D section.member.type.member_names() members_text =3D ', '.join(['@t{"%s"}' % v for v in values= ]) --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600811679; cv=none; d=zohomail.com; s=zohoarc; b=jWKFAhANFZPzyyPVhywigGHjfK9s7lsS/voWXFa4lNaUgAMVcachs6yLGlnUcSG2nfErx9vHCbKzMbEQ2RvYKBCqowtO9lAgnPIcQOV4ONkntThsCkunq50vXBX476nqjb1m8jemuN1cTpcgUzCAUCANFRz3XCFthOnVnXbjTSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600811679; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=43bTF9s1dRQvu261U43X/7PVH8f8W3mJYCwEL5RBQDk=; b=a8ZhVGnxtnweJdtEuHSycfKl4L8zKSFcgXJRL3hZCDFSFbwet47yxVKHziY4xiTj7HOEG1fLoAnA/+9lVLPC8FTaY6Zd6wS8VABo87LO1u2YcF9Gz0WaqZlKD1TWMol14TEWeyeQCgJQ4dKQEVOpha5FoUlG6kE791JrhNdOdxE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600811679440486.6100342822716; Tue, 22 Sep 2020 14:54:39 -0700 (PDT) Received: from localhost ([::1]:54144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqFC-0005Zi-2o for importer@patchew.org; Tue, 22 Sep 2020 17:54:38 -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 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 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) 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= X-MC-Unique: GwQOHXWWOuy_VydmK4BCMw-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 15:47:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- 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 +=3D '@item The members of @code{%s}\n' % base.doc_type() for variant in variants.variants if variants else (): + assert isinstance(variant.type, QAPISchemaObjectType) when =3D ' when @code{%s} is @t{"%s"}%s' % ( variants.tag_member.name, variant.name, texi_if(variant.ifcond, " (", ")")) --=20 2.26.2 From nobody Thu May 2 04:27:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600811876; cv=none; d=zohomail.com; s=zohoarc; b=cOAe3EM0vtU/tTljT2LKXv2W1RdFgOJGFWdXMi8NwqBUFgogBYvU4lS2lLtgx7fAcKM26gVGxjJiVVq+oGqdGR2cKjM81LCotmHrbOSDt+1vkrKEzYv+2P6yvdtpJql8JYqRmVA0toX9FVs/tFza+Q2oZ0qM84yAGfvBY3QfOKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600811876; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wLtuOYGmP4PpgM90n9U72U7fhjJLXm76tKv3IJ2+Wvk=; b=iJ7u1U1z6RF25CUm+XZXApyCqnKC22blZsxafy2ZKG9EH25bQwExLpZQGpXlWrzuCF+PAa+4eWJNf24gADLfwBdn0C0WKuSSCBDi7asHzmJuiG5jQO2sFEQZD/h95g3Yf1aSDGMnajcZnrnnJxxxIZ98LV7ZzcG6J/l7kBae2f8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600811876918977.7348480265766; Tue, 22 Sep 2020 14:57:56 -0700 (PDT) Received: from localhost ([::1]:33842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKqIN-0000VO-HC for importer@patchew.org; Tue, 22 Sep 2020 17:57:55 -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 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 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) 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= X-MC-Unique: KQ_hV1SROHWYuX4x3SHL6A-1 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Cleber Rosa , John Snow , Michael Roth , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Eduardo Habkost Tested-by: Eduardo Habkost based-on: <20200922211313.4082880-1-jsnow@redhat.com> --- scripts/qapi/pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index d7adb2ba33..fb0386d529 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -2,8 +2,7 @@ =20 # Add files or directories matching the regex patterns to the ignore list. # The regex matches against base names, not paths. -ignore-patterns=3Ddoc.py, - error.py, +ignore-patterns=3Derror.py, parser.py, schema.py, =20 --=20 2.26.2