From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155108; cv=none; d=zohomail.com; s=zohoarc; b=Qfz28j84EUhaKSTvGqLw/R73KItFknIKmH0v+upUmMa7HKmgT9hHYF7cfVvai+U/SHccCh9rVIDQsDpT4+zwAtlWxi3GovlpZjR956rHe78EPrAaFf8KZd3+jmA2RlA1TZ3xwz2n0r60okOZG+o8ePKGoMje/Ra7og5/fJogXC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155108; 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=gyu6YRyEOUXaV4fK7gqaAe9zNh4cqpHxZJP8Pogb7yk=; b=E34UGl+h/6RuDmXZne14I91Obg28vy7h12QEPvvdDp945zG7/M6Us+Zz+hceBAgnT1HSw9Xw93rokjpY1z3EvDEjSgCrHa0U4pRJOj4kc9Y2jvUrSpcKXr5fflufwIwbfbnfwh72YtPGYbCPZbR3Y8Oz5GXH++nXp2Fw7frrCuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155108299826.0485639532058; Thu, 23 Feb 2023 04:25:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdO-0002zA-OX; Thu, 23 Feb 2023 07:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdL-0002xP-DW for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdJ-0003y5-Dr for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-kP8mQkiROVOLVknnlp94ig-1; Thu, 23 Feb 2023 07:23:29 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5DBE2A59544; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A16E22166B2B; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8569421E6A20; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155012; 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=gyu6YRyEOUXaV4fK7gqaAe9zNh4cqpHxZJP8Pogb7yk=; b=OkrGC2dP6OsG+/7uPh8chh/9k6fJtV6YXuUVpUuQZMrrtSXGhblswm1/ZidVBTCAisuG/z GmbW1hOTgWfWogKXtL9/7Vj1fhG/39dwUwPBnD+3ahmjxEQo9RVg5AdKTykLwqQiQmPe2D ZhSIt8pOcSwWGKtwbgQ7VYyFbW+q+UU= X-MC-Unique: kP8mQkiROVOLVknnlp94ig-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Eric Blake , John Snow Subject: [PULL 1/8] docs/devel/qapi-code-gen: Belatedly update features documentation Date: Thu, 23 Feb 2023 13:23:20 +0100 Message-Id: <20230223122327.1920247-2-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155109466100001 Content-Type: text/plain; charset="utf-8" Commit 013b4efc9be "qapi: Add feature flags to remaining definitions" (v5.0.0), commit 84ab0086879 "qapi: Add feature flags to struct members" (v5.0.0), and commit b6c18755e41 "qapi: Add feature flags to enum members" (v6.2.0) neglected to update section "Features". Make up for that. Signed-off-by: Markus Armbruster Message-Id: <20230213132009.918801-2-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: John Snow --- docs/devel/qapi-code-gen.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index 5edc49aa74..566640edf8 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -685,9 +685,10 @@ change in the QMP syntax (usually by allowing values o= r operations that previously resulted in an error). QMP clients may still need to know whether the extension is available. =20 -For this purpose, a list of features can be specified for a command or -struct type. Each list member can either be ``{ 'name': STRING, '*if': -COND }``, or STRING, which is shorthand for ``{ 'name': STRING }``. +For this purpose, a list of features can be specified for definitions, +enumeration values, and struct members. Each feature list member can +either be ``{ 'name': STRING, '*if': COND }``, or STRING, which is +shorthand for ``{ 'name': STRING }``. =20 The optional 'if' member specifies a conditional. See `Configuring the schema`_ below for more on this. --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155051; cv=none; d=zohomail.com; s=zohoarc; b=TvrIaXIZm22sU8GYv9U0HIlg/LCGRvBmTDo1om2y6kAKmywuqOYqBWoXJvXMDgkUO/5YxeoDwrjofbLHLojqMSd8ND9FiEqg08O9I52MqdkXfmwXcZsoxs+U9qecsp9TxHxFVeDUfF97IYZtbskWqvMYojn3gL+EFnNazYF9WSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155051; 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=TlPzad5feeEw09+f2Wx+S34iHE9O/8LcRpwkEjJewx4=; b=AZsvplzSUOoQ0zAQxexSUstbLISdlpsMUhwr+t67a4u8liNks8ULHqtZpzcc/6nayeGNRyyYcryjpPBQheBdUBlsnFIMcB+vutMuPDXJM9UUZIS54L8UmMsm9TaS9u0RaY6fsqkp+uot5017sO6ElYn22n82HpYCH+dck1b8KmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155051184292.7281181571268; Thu, 23 Feb 2023 04:24:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdK-0002x8-VW; Thu, 23 Feb 2023 07:23:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdI-0002w4-Qu for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdH-0003xo-95 for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:32 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-1pi_H8A_NPWyVa4BHxuPNw-1; Thu, 23 Feb 2023 07:23:29 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7FE4858F09; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FACC492B00; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 87BBE21E6A21; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155010; 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=TlPzad5feeEw09+f2Wx+S34iHE9O/8LcRpwkEjJewx4=; b=ZVDnQIqLvGFt6ziOACI47C57ZqGRQv+Q8Fb5g5/Un+kTNYhXGk7uRE7vJ/JPQXXxWkAn7x 8x9WWyIvD2I1aBgZsj5cIb0k2L/OIumHBkb7x6jEIv0AxKqlrltWDtQFZLofyGn/rj8grn 9RoEpWNJSWOhDp6EfSmKtcZonhuA/yc= X-MC-Unique: 1pi_H8A_NPWyVa4BHxuPNw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Eric Blake , John Snow Subject: [PULL 2/8] docs/devel/qapi-code-gen: Fix a missing 'may', clarify SchemaInfo Date: Thu, 23 Feb 2023 13:23:21 +0100 Message-Id: <20230223122327.1920247-3-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155053130100013 Content-Type: text/plain; charset="utf-8" Documentation of enumeration value conditions lacks a 'may'. Fix that. Clarify SchemaInfo documentation for struct and union types. Signed-off-by: Markus Armbruster Message-Id: <20230213132009.918801-3-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: John Snow --- docs/devel/qapi-code-gen.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index 566640edf8..23e7f2fb1c 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -818,8 +818,8 @@ member 'bar' :: =20 A union's discriminator may not be conditional. =20 -Likewise, individual enumeration values be conditional. This requires -the longhand form of ENUM-VALUE_. +Likewise, individual enumeration values may be conditional. This +requires the longhand form of ENUM-VALUE_. =20 Example: an enum type with unconditional value 'foo' and conditional value 'bar' :: @@ -1158,9 +1158,8 @@ Example: the SchemaInfo for EVENT_C from section Even= ts_ :: Type "q_obj-EVENT_C-arg" is an implicitly defined object type with the two members from the event's definition. =20 -The SchemaInfo for struct and union types has meta-type "object". - -The SchemaInfo for a struct type has variant member "members". +The SchemaInfo for struct and union types has meta-type "object" and +variant member "members". =20 The SchemaInfo for a union type additionally has variant members "tag" and "variants". --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155090; cv=none; d=zohomail.com; s=zohoarc; b=RoGqECghN85U3A10Jg92jy79OQLGSL38UFR1ajU8nUkpGZ0/Ku6eGmfzAr1AScWR8RyEIEBXjNs+kCEv5pI3TOHRIlonYFiymNSJH7vQ1rTWaQytmM4CwgU/+muvQobW6j9ET5a1K9CAzu0FKEaz3itU0Ywzj7jq9C+zsQlBYmM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155090; 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=EuqbNzloE8p5VJVGICYz1ePjTwoKZYwYA8XMCXL9IOw=; b=LoLUwPjc0/SLLAK9JtQ0jLrVPXU8qRTkZhDKopCRU4acK7rr/6pZGo+K2kmsAwRTOrSOJ2/uVroz+rk3y6MGH3IyduNe6O0kMqYI7T9Na8yu5o4k8SOniEVzfXI7XI1mfOySYgL0AxDzpvrDGilvhX+2+gSnzx/HwseIksLKAlc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155090737524.7583882149391; Thu, 23 Feb 2023 04:24:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdO-0002yt-1A; Thu, 23 Feb 2023 07:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdK-0002wl-G7 for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdJ-0003y6-1J for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:34 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-UQ0mgSUiPhamu2fMxlTtqg-1; Thu, 23 Feb 2023 07:23:29 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70763813F3B; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FC452026D4B; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8A34721E6A22; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155012; 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=EuqbNzloE8p5VJVGICYz1ePjTwoKZYwYA8XMCXL9IOw=; b=D7yR1qSBrEjZmCD7HL7N82NRiTVa/pa7C6OdhkZhFARx3jvDjWPixuditmfJkqoK9oIz47 zs+gPXwjTw2XwayiBfjjh47tWg4wZ2JEwxJwpAh57az9IkRLNv0hnOE2/wRw/Aj5nW4fm/ FDLaBQnMKKX68OJKkUIkA1rct497oM4= X-MC-Unique: UQ0mgSUiPhamu2fMxlTtqg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 3/8] qapi: Update flake8 config Date: Thu, 23 Feb 2023 13:23:22 +0100 Message-Id: <20230223122327.1920247-4-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155091295100001 Content-Type: text/plain; charset="utf-8" From: John Snow New versions of flake8 don't like same-line comments. (It's a version newer than what fc37 ships, but it still makes my life easier to fix it now.) Signed-off-by: John Snow Reviewed-by: Markus Armbruster Message-Id: <20230215000011.1725012-2-jsnow@redhat.com> --- scripts/qapi/.flake8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/.flake8 b/scripts/qapi/.flake8 index 6b158c68b8..a873ff6730 100644 --- a/scripts/qapi/.flake8 +++ b/scripts/qapi/.flake8 @@ -1,2 +1,3 @@ [flake8] -extend-ignore =3D E722 # Prefer pylint's bare-except checks to flake8's +# Prefer pylint's bare-except checks to flake8's +extend-ignore =3D E722 --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155065; cv=none; d=zohomail.com; s=zohoarc; b=mFtiUIWjg23FU40OqZjdC5PZdlSyc/XLgPezp5zRB+xB5hQv145wHX4G/Sx3ivoUv6T+GlA9RZhBFzSr6CpBmRaj+ZLkniScWsxHfU9AGlleYV/RPdIQPp32n9jNiB/Ygq33k8i1P7iHrTJiGh3/KY9Lu/0Defnuu7YeqaaPjQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155065; 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=yOFlZsty6p8TgvR1vUxvTDz/q6RTEIA7aKDoRnWfEUM=; b=Ln+0NGq56U8DxPmVUK34Xw52OBJl206mzxcgKw3TgNsI1or1iSkkpeF+AAwY2fqxJ3S5YILToDjAyXnely+JMHBSVzdW2BR6TA5e6zONIrMY8VMnxPAP/Ko/jxfSB83s+XFNT1WSZHrpp2hBogezrTTaQDx6mHNGjm8DvqgGJKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155065772545.863759881135; Thu, 23 Feb 2023 04:24:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdK-0002wW-8p; Thu, 23 Feb 2023 07:23:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdI-0002w3-QD for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdH-0003xn-95 for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:32 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-_eXceLRaP9axfRyasTLotg-1; Thu, 23 Feb 2023 07:23:29 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70D73813F3C; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F420492C3E; Thu, 23 Feb 2023 12:23:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8CCDE21E6A23; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155010; 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=yOFlZsty6p8TgvR1vUxvTDz/q6RTEIA7aKDoRnWfEUM=; b=iRGkNutooIJWkEtctbz3dD24+HXPG1kKgKs8JKgnfN+zsdbJYDCQEgVCI8nXdIwIxPaifl qsqJe7X46oMc5kXtyBLnRv8wLnoMbc8QtLvWbhu+2HJXKdB0nml0ilObW2lCu2iKHKubXd 1kM+/k982KgN4oqwmuyQVH0jhNa5MdM= X-MC-Unique: _eXceLRaP9axfRyasTLotg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 4/8] qapi: update pylint configuration Date: Thu, 23 Feb 2023 13:23:23 +0100 Message-Id: <20230223122327.1920247-5-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155067118100001 Content-Type: text/plain; charset="utf-8" From: John Snow Newer versions of pylint disable the "no-self-use" message by default. Older versions don't, though. If we leave the suppressions in, pylint yelps about useless options. Just tell pylint to shush. Signed-off-by: John Snow Reviewed-by: Markus Armbruster Message-Id: <20230215000011.1725012-3-jsnow@redhat.com> --- scripts/qapi/pylintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index a724628203..90546df534 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -23,6 +23,7 @@ disable=3Dfixme, too-many-statements, too-many-instance-attributes, consider-using-f-string, + useless-option-value, =20 [REPORTS] =20 --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155113; cv=none; d=zohomail.com; s=zohoarc; b=T6e6HP7+XNVQ9w0rCpvuG8zLyn7lYIVc823HRAGgLXK65McS94bddmJkln1Zfsb/eD24GiJzAyNmYpNRPt8yu/wDr9++KtEwUpLLRB3beLHh8p4cuhFNNU57PWr+WbzBkLEYcGdrW+3pjRDFljh82dEx7bm8e03RUqRPJqX4gNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155113; 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=7vhFRU/UKtNpcUDpNmY0QPHvlmmZdAVaFnOsl5iQ5H0=; b=iMQgPLzgBgnwXeDulAJ/cDj2ROg3Ws5vIGfO13J8PpqPnKnuoId1mZJGO5dqxu48OraXV1SLj7d7ARNDQ+JoO6bLxZHwEYqNPVpDRMlKCoRIGh90JjydmAPq5Y8C6M9ZDwn9YKqhwgIXGP9bFV1EpkJBXGal/mDAHo1e8mwnl9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155113529441.7579532607001; Thu, 23 Feb 2023 04:25:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdN-0002yk-9Y; Thu, 23 Feb 2023 07:23:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdL-0002xk-MO for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdK-0003yY-0T for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-LFz2XuiyM12oiEPgsiaL4A-1; Thu, 23 Feb 2023 07:23:30 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 112C43813F38; Thu, 23 Feb 2023 12:23:30 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3A811121314; Thu, 23 Feb 2023 12:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8FB1B21E6A24; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155013; 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=7vhFRU/UKtNpcUDpNmY0QPHvlmmZdAVaFnOsl5iQ5H0=; b=CJkqGMsuN8O2NNvZtDkVTzS1UZIvJGJHA+AofzID9bOPVXv6G/lL6dkfsiOFzRMN2lyZHB Jj0COBKwjqb4dAqJE2JJh5kO6oytUxeuYhLkYwReo8lHLoMqqatxMGvueWdBthkFgbubel YJWKqHuDvAQD6JEBiJyGewwfUaRak9E= X-MC-Unique: LFz2XuiyM12oiEPgsiaL4A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 5/8] qapi: Add minor typing workaround for 3.6 Date: Thu, 23 Feb 2023 13:23:24 +0100 Message-Id: <20230223122327.1920247-6-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155115585100003 Content-Type: text/plain; charset="utf-8" From: John Snow Pylint under 3.6 does not believe that Collection is subscriptable at runtime. It is, making this a Pylint bug. https://github.com/PyCQA/pylint/issues/2377 They closed it as fixed, but that doesn't seem to be true as of Pylint 2.13.9, the latest version you can install under Python 3.6. 2.13.9 was released 2022-05-13, about seven months after the bug was closed. The least-annoying fix here is to just use the concret type. Signed-off-by: John Snow Message-Id: <20230215000011.1725012-4-jsnow@redhat.com> [Dumbed down from Sequence[str] to List[str], commit message adjusted] Reviewed-by: Markus Armbruster --- scripts/qapi/expr.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 5a1782b57e..358b8e2a8b 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -33,7 +33,6 @@ =20 import re from typing import ( - Collection, Dict, Iterable, List, @@ -195,8 +194,8 @@ def check_defn_name_str(name: str, info: QAPISourceInfo= , meta: str) -> None: def check_keys(value: _JSONObject, info: QAPISourceInfo, source: str, - required: Collection[str], - optional: Collection[str]) -> None: + required: List[str], + optional: List[str]) -> None: """ Ensure that a dict has a specific set of keys. =20 --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155122; cv=none; d=zohomail.com; s=zohoarc; b=e0hXb4VtJBrXu+Tc9AYXzyXax0QhgmtaobNngml79PKgy5eCTGtsV4tYfXZxGRBobqrFZx/CQ2nycY/HpifroAjQynQG1aDyMyxbrtMntBUjy4aTtKnk5UVXopLewlkwzeWDkJEBCVH29RcS6xas0ycMzXVLS1eLsl6/V3vUsWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155122; 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=VkK2TG7D0ZUc7413rqE7HSFrQO96bHcN4kOu4/9E7oQ=; b=XhdGQXznrY8wyskR9zAdAnGGOOAcFycZfCpdr9bvGYCHXg0tsjBQnyQY3E551km3/tJKx0wff459ubNvWXpNsJZSN0gaAQFCk86aw1B4LPlojZuh/slToQ7Tnaj1y2/VFp9rd911am6TLtuYyln1SG1XSK8ismhxWlLHg+15zhk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155122152695.8851079621874; Thu, 23 Feb 2023 04:25:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdN-0002yj-7c; Thu, 23 Feb 2023 07:23:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdL-0002xQ-Dz for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdI-0003xy-E1 for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:35 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-400-Pqk-nxkGNP-Xd97xeLIRJg-1; Thu, 23 Feb 2023 07:23:30 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 491F63813F3B; Thu, 23 Feb 2023 12:23:30 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E280F492C3E; Thu, 23 Feb 2023 12:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 92B2E21E6A25; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155011; 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=VkK2TG7D0ZUc7413rqE7HSFrQO96bHcN4kOu4/9E7oQ=; b=PpsyUx5Sk2vATBCBEZvsWnA4oNeAJzFkaDtkxC1jwR86KsbK2i16GgH/nAieIaEDeoZRdb eDRGjeDcusaR/RgWPs2na1sw9RND4jVVl+pjSYm+lTrngrS5bJkEUBk1b82jjhACfzmoDM K5LsjrAEsA0XVhgPi8tmjFJydIx3vGA= X-MC-Unique: Pqk-nxkGNP-Xd97xeLIRJg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 6/8] qapi/parser: add QAPIExpression type Date: Thu, 23 Feb 2023 13:23:25 +0100 Message-Id: <20230223122327.1920247-7-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155123789100002 Content-Type: text/plain; charset="utf-8" From: John Snow This patch creates a new type, QAPIExpression, which represents a parsed expression complete with QAPIDoc and QAPISourceInfo. This patch turns parser.exprs into a list of QAPIExpression instead, and adjusts expr.py to match. This allows the types we specify in parser.py to be "remembered" all the way through expr.py and into schema.py. Several assertions around packing and unpacking this data can be removed as a result. It also corrects a harmless typing error. Before the patch, check_exprs() allegedly takes a List[_JSONObject]. It actually takes a list of dicts of the form {'expr': E, 'info': I, 'doc': D} where E is of type _ExprValue, I is of type QAPISourceInfo, and D is of type QAPIDoc. Key 'doc' is optional. This is not a _JSONObject! Passes type checking anyway, because _JSONObject is Dict[str, object]. Signed-off-by: John Snow Message-Id: <20230215000011.1725012-5-jsnow@redhat.com> Reviewed-by: Markus Armbruster [Commit message amended to point out the typing fix] --- scripts/qapi/expr.py | 82 +++++++++++++++++------------------------- scripts/qapi/parser.py | 46 ++++++++++++++---------- scripts/qapi/schema.py | 72 ++++++++++++++++++++----------------- 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 358b8e2a8b..b8f905543e 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -43,7 +43,7 @@ =20 from .common import c_name from .error import QAPISemError -from .parser import QAPIDoc +from .parser import QAPIExpression from .source import QAPISourceInfo =20 =20 @@ -228,12 +228,11 @@ def pprint(elems: Iterable[str]) -> str: pprint(unknown), pprint(allowed))) =20 =20 -def check_flags(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_flags(expr: QAPIExpression) -> None: """ Ensure flag members (if present) have valid values. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When certain flags have an invalid value, or when @@ -242,18 +241,18 @@ def check_flags(expr: _JSONObject, info: QAPISourceIn= fo) -> None: for key in ('gen', 'success-response'): if key in expr and expr[key] is not False: raise QAPISemError( - info, "flag '%s' may only use false value" % key) + expr.info, "flag '%s' may only use false value" % key) for key in ('boxed', 'allow-oob', 'allow-preconfig', 'coroutine'): if key in expr and expr[key] is not True: raise QAPISemError( - info, "flag '%s' may only use true value" % key) + expr.info, "flag '%s' may only use true value" % key) if 'allow-oob' in expr and 'coroutine' in expr: # This is not necessarily a fundamental incompatibility, but # we don't have a use case and the desired semantics isn't # obvious. The simplest solution is to forbid it until we get # a use case for it. - raise QAPISemError(info, "flags 'allow-oob' and 'coroutine' " - "are incompatible") + raise QAPISemError( + expr.info, "flags 'allow-oob' and 'coroutine' are incompatible= ") =20 =20 def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None: @@ -446,12 +445,11 @@ def check_features(features: Optional[object], check_if(feat, info, source) =20 =20 -def check_enum(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_enum(expr: QAPIExpression) -> None: """ Normalize and validate this expression as an ``enum`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When ``expr`` is not a valid ``enum``. :return: None, ``expr`` is normalized in-place as needed. @@ -459,6 +457,7 @@ def check_enum(expr: _JSONObject, info: QAPISourceInfo)= -> None: name =3D expr['enum'] members =3D expr['data'] prefix =3D expr.get('prefix') + info =3D expr.info =20 if not isinstance(members, list): raise QAPISemError(info, "'data' must be an array") @@ -485,12 +484,11 @@ def check_enum(expr: _JSONObject, info: QAPISourceInf= o) -> None: check_features(member.get('features'), info) =20 =20 -def check_struct(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_struct(expr: QAPIExpression) -> None: """ Normalize and validate this expression as a ``struct`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When ``expr`` is not a valid ``struct``. :return: None, ``expr`` is normalized in-place as needed. @@ -498,16 +496,15 @@ def check_struct(expr: _JSONObject, info: QAPISourceI= nfo) -> None: name =3D cast(str, expr['struct']) # Checked in check_exprs members =3D expr['data'] =20 - check_type(members, info, "'data'", allow_dict=3Dname) - check_type(expr.get('base'), info, "'base'") + check_type(members, expr.info, "'data'", allow_dict=3Dname) + check_type(expr.get('base'), expr.info, "'base'") =20 =20 -def check_union(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_union(expr: QAPIExpression) -> None: """ Normalize and validate this expression as a ``union`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: when ``expr`` is not a valid ``union``. :return: None, ``expr`` is normalized in-place as needed. @@ -516,6 +513,7 @@ def check_union(expr: _JSONObject, info: QAPISourceInfo= ) -> None: base =3D expr['base'] discriminator =3D expr['discriminator'] members =3D expr['data'] + info =3D expr.info =20 check_type(base, info, "'base'", allow_dict=3Dname) check_name_is_str(discriminator, info, "'discriminator'") @@ -530,17 +528,17 @@ def check_union(expr: _JSONObject, info: QAPISourceIn= fo) -> None: check_type(value['type'], info, source, allow_array=3Dnot base) =20 =20 -def check_alternate(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_alternate(expr: QAPIExpression) -> None: """ Normalize and validate this expression as an ``alternate`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When ``expr`` is not a valid ``alternate``. :return: None, ``expr`` is normalized in-place as needed. """ members =3D expr['data'] + info =3D expr.info =20 if not members: raise QAPISemError(info, "'data' must not be empty") @@ -556,12 +554,11 @@ def check_alternate(expr: _JSONObject, info: QAPISour= ceInfo) -> None: check_type(value['type'], info, source, allow_array=3DTrue) =20 =20 -def check_command(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_command(expr: QAPIExpression) -> None: """ Normalize and validate this expression as a ``command`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When ``expr`` is not a valid ``command``. :return: None, ``expr`` is normalized in-place as needed. @@ -571,17 +568,16 @@ def check_command(expr: _JSONObject, info: QAPISource= Info) -> None: boxed =3D expr.get('boxed', False) =20 if boxed and args is None: - raise QAPISemError(info, "'boxed': true requires 'data'") - check_type(args, info, "'data'", allow_dict=3Dnot boxed) - check_type(rets, info, "'returns'", allow_array=3DTrue) + raise QAPISemError(expr.info, "'boxed': true requires 'data'") + check_type(args, expr.info, "'data'", allow_dict=3Dnot boxed) + check_type(rets, expr.info, "'returns'", allow_array=3DTrue) =20 =20 -def check_event(expr: _JSONObject, info: QAPISourceInfo) -> None: +def check_event(expr: QAPIExpression) -> None: """ Normalize and validate this expression as an ``event`` definition. =20 :param expr: The expression to validate. - :param info: QAPI schema source file information. =20 :raise QAPISemError: When ``expr`` is not a valid ``event``. :return: None, ``expr`` is normalized in-place as needed. @@ -590,11 +586,11 @@ def check_event(expr: _JSONObject, info: QAPISourceIn= fo) -> None: boxed =3D expr.get('boxed', False) =20 if boxed and args is None: - raise QAPISemError(info, "'boxed': true requires 'data'") - check_type(args, info, "'data'", allow_dict=3Dnot boxed) + raise QAPISemError(expr.info, "'boxed': true requires 'data'") + check_type(args, expr.info, "'data'", allow_dict=3Dnot boxed) =20 =20 -def check_exprs(exprs: List[_JSONObject]) -> List[_JSONObject]: +def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]: """ Validate and normalize a list of parsed QAPI schema expressions. =20 @@ -606,21 +602,9 @@ def check_exprs(exprs: List[_JSONObject]) -> List[_JSO= NObject]: :raise QAPISemError: When any expression fails validation. :return: The same list of expressions (now modified). """ - for expr_elem in exprs: - # Expression - assert isinstance(expr_elem['expr'], dict) - for key in expr_elem['expr'].keys(): - assert isinstance(key, str) - expr: _JSONObject =3D expr_elem['expr'] - - # QAPISourceInfo - assert isinstance(expr_elem['info'], QAPISourceInfo) - info: QAPISourceInfo =3D expr_elem['info'] - - # Optional[QAPIDoc] - tmp =3D expr_elem.get('doc') - assert tmp is None or isinstance(tmp, QAPIDoc) - doc: Optional[QAPIDoc] =3D tmp + for expr in exprs: + info =3D expr.info + doc =3D expr.doc =20 if 'include' in expr: continue @@ -652,24 +636,24 @@ def check_exprs(exprs: List[_JSONObject]) -> List[_JS= ONObject]: if meta =3D=3D 'enum': check_keys(expr, info, meta, ['enum', 'data'], ['if', 'features', 'prefix']) - check_enum(expr, info) + check_enum(expr) elif meta =3D=3D 'union': check_keys(expr, info, meta, ['union', 'base', 'discriminator', 'data'], ['if', 'features']) normalize_members(expr.get('base')) normalize_members(expr['data']) - check_union(expr, info) + check_union(expr) elif meta =3D=3D 'alternate': check_keys(expr, info, meta, ['alternate', 'data'], ['if', 'features']) normalize_members(expr['data']) - check_alternate(expr, info) + check_alternate(expr) elif meta =3D=3D 'struct': check_keys(expr, info, meta, ['struct', 'data'], ['base', 'if', 'features']) normalize_members(expr['data']) - check_struct(expr, info) + check_struct(expr) elif meta =3D=3D 'command': check_keys(expr, info, meta, ['command'], @@ -677,17 +661,17 @@ def check_exprs(exprs: List[_JSONObject]) -> List[_JS= ONObject]: 'gen', 'success-response', 'allow-oob', 'allow-preconfig', 'coroutine']) normalize_members(expr.get('data')) - check_command(expr, info) + check_command(expr) elif meta =3D=3D 'event': check_keys(expr, info, meta, ['event'], ['data', 'boxed', 'if', 'features']) normalize_members(expr.get('data')) - check_event(expr, info) + check_event(expr) else: assert False, 'unexpected meta type' =20 check_if(expr, info, meta) check_features(expr.get('features'), info) - check_flags(expr, info) + check_flags(expr) =20 return exprs diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 1b006cdc13..50906e27d4 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -21,6 +21,7 @@ TYPE_CHECKING, Dict, List, + Mapping, Optional, Set, Union, @@ -37,15 +38,24 @@ from .schema import QAPISchemaFeature, QAPISchemaMember =20 =20 -#: Represents a single Top Level QAPI schema expression. -TopLevelExpr =3D Dict[str, object] - # Return value alias for get_expr(). _ExprValue =3D Union[List[object], Dict[str, object], str, bool] =20 -# FIXME: Consolidate and centralize definitions for TopLevelExpr, -# _ExprValue, _JSONValue, and _JSONObject; currently scattered across -# several modules. + +# FIXME: Consolidate and centralize definitions for _ExprValue, +# JSONValue, and _JSONObject; currently scattered across several +# modules. + + +class QAPIExpression(Dict[str, object]): + # pylint: disable=3Dtoo-few-public-methods + def __init__(self, + data: Mapping[str, object], + info: QAPISourceInfo, + doc: Optional['QAPIDoc'] =3D None): + super().__init__(data) + self.info =3D info + self.doc: Optional['QAPIDoc'] =3D doc =20 =20 class QAPIParseError(QAPISourceError): @@ -100,7 +110,7 @@ def __init__(self, self.line_pos =3D 0 =20 # Parser output: - self.exprs: List[Dict[str, object]] =3D [] + self.exprs: List[QAPIExpression] =3D [] self.docs: List[QAPIDoc] =3D [] =20 # Showtime! @@ -147,8 +157,7 @@ def _parse(self) -> None: "value of 'include' must be a strin= g") incl_fname =3D os.path.join(os.path.dirname(self._fname), include) - self.exprs.append({'expr': {'include': incl_fname}, - 'info': info}) + self._add_expr(OrderedDict({'include': incl_fname}), info) exprs_include =3D self._include(include, info, incl_fname, self._included) if exprs_include: @@ -165,17 +174,18 @@ def _parse(self) -> None: for name, value in pragma.items(): self._pragma(name, value, info) else: - expr_elem =3D {'expr': expr, - 'info': info} - if cur_doc: - if not cur_doc.symbol: - raise QAPISemError( - cur_doc.info, "definition documentation requir= ed") - expr_elem['doc'] =3D cur_doc - self.exprs.append(expr_elem) + if cur_doc and not cur_doc.symbol: + raise QAPISemError( + cur_doc.info, "definition documentation required") + self._add_expr(expr, info, cur_doc) cur_doc =3D None self.reject_expr_doc(cur_doc) =20 + def _add_expr(self, expr: Mapping[str, object], + info: QAPISourceInfo, + doc: Optional['QAPIDoc'] =3D None) -> None: + self.exprs.append(QAPIExpression(expr, info, doc)) + @staticmethod def reject_expr_doc(doc: Optional['QAPIDoc']) -> None: if doc and doc.symbol: @@ -784,7 +794,7 @@ def connect_feature(self, feature: 'QAPISchemaFeature')= -> None: % feature.name) self.features[feature.name].connect(feature) =20 - def check_expr(self, expr: TopLevelExpr) -> None: + def check_expr(self, expr: QAPIExpression) -> None: if self.has_section('Returns') and 'command' not in expr: raise QAPISemError(self.info, "'Returns:' is only valid for commands") diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index cd8661125c..207e4d71f3 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -17,7 +17,7 @@ from collections import OrderedDict import os import re -from typing import Optional +from typing import List, Optional =20 from .common import ( POINTER_SUFFIX, @@ -29,7 +29,7 @@ ) from .error import QAPIError, QAPISemError, QAPISourceError from .expr import check_exprs -from .parser import QAPISchemaParser +from .parser import QAPIExpression, QAPISchemaParser =20 =20 class QAPISchemaIfCond: @@ -964,10 +964,11 @@ def module_by_fname(self, fname): name =3D self._module_name(fname) return self._module_dict[name] =20 - def _def_include(self, expr, info, doc): + def _def_include(self, expr: QAPIExpression): include =3D expr['include'] - assert doc is None - self._def_entity(QAPISchemaInclude(self._make_module(include), inf= o)) + assert expr.doc is None + self._def_entity( + QAPISchemaInclude(self._make_module(include), expr.info)) =20 def _def_builtin_type(self, name, json_type, c_type): self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type)) @@ -1045,14 +1046,15 @@ def _make_implicit_object_type(self, name, info, if= cond, role, members): name, info, None, ifcond, None, None, members, None)) return name =20 - def _def_enum_type(self, expr, info, doc): + def _def_enum_type(self, expr: QAPIExpression): name =3D expr['enum'] data =3D expr['data'] prefix =3D expr.get('prefix') ifcond =3D QAPISchemaIfCond(expr.get('if')) + info =3D expr.info features =3D self._make_features(expr.get('features'), info) self._def_entity(QAPISchemaEnumType( - name, info, doc, ifcond, features, + name, info, expr.doc, ifcond, features, self._make_enum_members(data, info), prefix)) =20 def _make_member(self, name, typ, ifcond, features, info): @@ -1072,14 +1074,15 @@ def _make_members(self, data, info): value.get('features'), info) for (key, value) in data.items()] =20 - def _def_struct_type(self, expr, info, doc): + def _def_struct_type(self, expr: QAPIExpression): name =3D expr['struct'] base =3D expr.get('base') data =3D expr['data'] + info =3D expr.info ifcond =3D QAPISchemaIfCond(expr.get('if')) features =3D self._make_features(expr.get('features'), info) self._def_entity(QAPISchemaObjectType( - name, info, doc, ifcond, features, base, + name, info, expr.doc, ifcond, features, base, self._make_members(data, info), None)) =20 @@ -1089,11 +1092,13 @@ def _make_variant(self, case, typ, ifcond, info): typ =3D self._make_array_type(typ[0], info) return QAPISchemaVariant(case, info, typ, ifcond) =20 - def _def_union_type(self, expr, info, doc): + def _def_union_type(self, expr: QAPIExpression): name =3D expr['union'] base =3D expr['base'] tag_name =3D expr['discriminator'] data =3D expr['data'] + assert isinstance(data, dict) + info =3D expr.info ifcond =3D QAPISchemaIfCond(expr.get('if')) features =3D self._make_features(expr.get('features'), info) if isinstance(base, dict): @@ -1105,17 +1110,19 @@ def _def_union_type(self, expr, info, doc): QAPISchemaIfCond(value.get('if')), info) for (key, value) in data.items()] - members =3D [] + members: List[QAPISchemaObjectTypeMember] =3D [] self._def_entity( - QAPISchemaObjectType(name, info, doc, ifcond, features, + QAPISchemaObjectType(name, info, expr.doc, ifcond, features, base, members, QAPISchemaVariants( tag_name, info, None, variants))) =20 - def _def_alternate_type(self, expr, info, doc): + def _def_alternate_type(self, expr: QAPIExpression): name =3D expr['alternate'] data =3D expr['data'] + assert isinstance(data, dict) ifcond =3D QAPISchemaIfCond(expr.get('if')) + info =3D expr.info features =3D self._make_features(expr.get('features'), info) variants =3D [ self._make_variant(key, value['type'], @@ -1124,11 +1131,11 @@ def _def_alternate_type(self, expr, info, doc): for (key, value) in data.items()] tag_member =3D QAPISchemaObjectTypeMember('type', info, 'QType', F= alse) self._def_entity( - QAPISchemaAlternateType(name, info, doc, ifcond, features, - QAPISchemaVariants( - None, info, tag_member, variants))) + QAPISchemaAlternateType( + name, info, expr.doc, ifcond, features, + QAPISchemaVariants(None, info, tag_member, variants))) =20 - def _def_command(self, expr, info, doc): + def _def_command(self, expr: QAPIExpression): name =3D expr['command'] data =3D expr.get('data') rets =3D expr.get('returns') @@ -1139,6 +1146,7 @@ def _def_command(self, expr, info, doc): allow_preconfig =3D expr.get('allow-preconfig', False) coroutine =3D expr.get('coroutine', False) ifcond =3D QAPISchemaIfCond(expr.get('if')) + info =3D expr.info features =3D self._make_features(expr.get('features'), info) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( @@ -1147,44 +1155,42 @@ def _def_command(self, expr, info, doc): if isinstance(rets, list): assert len(rets) =3D=3D 1 rets =3D self._make_array_type(rets[0], info) - self._def_entity(QAPISchemaCommand(name, info, doc, ifcond, featur= es, - data, rets, + self._def_entity(QAPISchemaCommand(name, info, expr.doc, ifcond, + features, data, rets, gen, success_response, boxed, allow_oob, allow_preconf= ig, coroutine)) =20 - def _def_event(self, expr, info, doc): + def _def_event(self, expr: QAPIExpression): name =3D expr['event'] data =3D expr.get('data') boxed =3D expr.get('boxed', False) ifcond =3D QAPISchemaIfCond(expr.get('if')) + info =3D expr.info features =3D self._make_features(expr.get('features'), info) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( name, info, ifcond, 'arg', self._make_members(data, info)) - self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, features, - data, boxed)) + self._def_entity(QAPISchemaEvent(name, info, expr.doc, ifcond, + features, data, boxed)) =20 def _def_exprs(self, exprs): - for expr_elem in exprs: - expr =3D expr_elem['expr'] - info =3D expr_elem['info'] - doc =3D expr_elem.get('doc') + for expr in exprs: if 'enum' in expr: - self._def_enum_type(expr, info, doc) + self._def_enum_type(expr) elif 'struct' in expr: - self._def_struct_type(expr, info, doc) + self._def_struct_type(expr) elif 'union' in expr: - self._def_union_type(expr, info, doc) + self._def_union_type(expr) elif 'alternate' in expr: - self._def_alternate_type(expr, info, doc) + self._def_alternate_type(expr) elif 'command' in expr: - self._def_command(expr, info, doc) + self._def_command(expr) elif 'event' in expr: - self._def_event(expr, info, doc) + self._def_event(expr) elif 'include' in expr: - self._def_include(expr, info, doc) + self._def_include(expr) else: assert False =20 --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155049; cv=none; d=zohomail.com; s=zohoarc; b=hPiB5xlj4qIDChmQWQUUuV68QCR06gQL2dpREH5e+G+gGVM0CwLPwz0SqQjKztXeqJNQjn186zPMkRzE7VRHOhFvYej7x0yohDL0/EhSdjDRmt8HPkDI+1n5mWGj5W1zZckjkweYczWcWODCgsPdID0xeJxWvYM15ao8J3/BdOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155049; 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=BUvYrs36Fw2EcK13M+SuNGSsi5rpmvOpq0anLP27ceg=; b=i6KuvXYHUmmWfFayL7disVro89zqrTGlOBLDcU4z4f+7H0vHzwPztffyI+eYc3eO96cmTBVew6bdEAnrU5+kiUI3V3Egj7bMznVIK+rIHj88u86ixb9dOBwYykse1V1UlVvyUyqLUCgj0wxgZxLFLrtKM2v6L8SLNifHxs/nX4w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155049911376.8160273252523; Thu, 23 Feb 2023 04:24:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdL-0002xR-Ib; Thu, 23 Feb 2023 07:23:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdK-0002wV-3D for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdI-0003xv-9v for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:33 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-Tlq0aod9N8C0LCdta9P63Q-1; Thu, 23 Feb 2023 07:23:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EF3518A6464; Thu, 23 Feb 2023 12:23:30 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2F78400D79D; Thu, 23 Feb 2023 12:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 953C021E6A26; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155011; 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=BUvYrs36Fw2EcK13M+SuNGSsi5rpmvOpq0anLP27ceg=; b=Cgr5+Fh9fdMSQ2DtEpWwaRQZ7GQ2S+kvFvcnzcI1ncZBtfNKBbS9E82muxMk/8nYG5YGct lfWPboXY+eq/LuxnwWuU8fKc8cE0uu4x//oZbOX3YngUEVoUPmOX3K7ZxQ9UkUKCnvCrNP bEUEQjXr758oGSzh43ZxpFar0vXojXI= X-MC-Unique: Tlq0aod9N8C0LCdta9P63Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 7/8] qapi: remove _JSONObject Date: Thu, 23 Feb 2023 13:23:26 +0100 Message-Id: <20230223122327.1920247-8-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155051030100005 Content-Type: text/plain; charset="utf-8" From: John Snow We can remove this alias as it only has two usages now, and no longer pays for the confusion of "yet another type". Signed-off-by: John Snow Message-Id: <20230215000011.1725012-6-jsnow@redhat.com> Reviewed-by: Markus Armbruster --- scripts/qapi/expr.py | 13 +++---------- scripts/qapi/parser.py | 5 ++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index b8f905543e..ca01ea6f4a 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -47,14 +47,6 @@ from .source import QAPISourceInfo =20 =20 -# Deserialized JSON objects as returned by the parser. -# The values of this mapping are not necessary to exhaustively type -# here (and also not practical as long as mypy lacks recursive -# types), because the purpose of this module is to interrogate that -# type. -_JSONObject =3D Dict[str, object] - - # See check_name_str(), below. valid_name =3D re.compile(r'(__[a-z0-9.-]+_)?' r'(x-)?' @@ -191,7 +183,7 @@ def check_defn_name_str(name: str, info: QAPISourceInfo= , meta: str) -> None: info, "%s name should not end in 'List'" % meta) =20 =20 -def check_keys(value: _JSONObject, +def check_keys(value: Dict[str, object], info: QAPISourceInfo, source: str, required: List[str], @@ -255,7 +247,8 @@ def check_flags(expr: QAPIExpression) -> None: expr.info, "flags 'allow-oob' and 'coroutine' are incompatible= ") =20 =20 -def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None: +def check_if(expr: Dict[str, object], + info: QAPISourceInfo, source: str) -> None: """ Validate the ``if`` member of an object. =20 diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 50906e27d4..d570086e1a 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -42,9 +42,8 @@ _ExprValue =3D Union[List[object], Dict[str, object], str, bool] =20 =20 -# FIXME: Consolidate and centralize definitions for _ExprValue, -# JSONValue, and _JSONObject; currently scattered across several -# modules. +# FIXME: Consolidate and centralize definitions for _ExprValue and +# JSONValue; currently scattered across several modules. =20 =20 class QAPIExpression(Dict[str, object]): --=20 2.39.0 From nobody Sun May 19 11:06:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677155050; cv=none; d=zohomail.com; s=zohoarc; b=NjxAHxI3UXA9lmXCcn8+OBfxEEOIC6UBwPBC3ouIIB4LM19CXI7VW9m92y9t3lBL77XNJPcJ7kIV84NCzYviwQ1FoLPtoIMs7pJlgQEPWeswBtkyvPL1HIEWO2zken654VJrdPNDaGv71RWAsP8jDKx1jXxhElGd1MSE2tGXBoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677155050; 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=rSqE7IZwMPjeZ8A1bxMdfnSECyu7I43VbnKR+si8cwY=; b=aBaqehff/LLJCv/tV74sV+AmBG0sR3PMyeA7WXRCg980ORWqdEp9g4bxXFiwBxjc6fVs9IzVPB9kyACRvZj1aCj8OJWz1McTCKpxKSTg4bfPjy2mND1//p3bw0bnNpkDXIVF4PmDDGrMPvjhZszYZx8rCXf/ClTQzc7onDCxyaw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677155050757287.14833156021825; Thu, 23 Feb 2023 04:24:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVAdU-00030K-Vz; Thu, 23 Feb 2023 07:23:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdT-00030C-KD for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVAdS-0003zd-5n for qemu-devel@nongnu.org; Thu, 23 Feb 2023 07:23:43 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-636-tTKwuelpN2GC1c5BDZ0EqQ-1; Thu, 23 Feb 2023 07:23:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11929857A89; Thu, 23 Feb 2023 12:23:30 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3956440D9; Thu, 23 Feb 2023 12:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 97B6A21E6A28; Thu, 23 Feb 2023 13:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677155021; 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=rSqE7IZwMPjeZ8A1bxMdfnSECyu7I43VbnKR+si8cwY=; b=NdNa0XJL2vp6s1tGF086easY+JmelzCc4XQqXsaMr8XkQyhXqbOLXUtpCSEOsNb+R819gJ PZNvmVjcTraxI+0oZqO2JrTAYCHHsRFJfkHRUTf6BobdctdglOcg4P5E5SZs7B9Etkmu0k dCwhk8q5AxUeA0iFIRWIjQcjShWvOVM= X-MC-Unique: tTKwuelpN2GC1c5BDZ0EqQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Snow Subject: [PULL 8/8] qapi: remove JSON value FIXME Date: Thu, 23 Feb 2023 13:23:27 +0100 Message-Id: <20230223122327.1920247-9-armbru@redhat.com> In-Reply-To: <20230223122327.1920247-1-armbru@redhat.com> References: <20230223122327.1920247-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677155051035100006 Content-Type: text/plain; charset="utf-8" From: John Snow With the two major JSON-ish type hierarchies clarified for distinct purposes; QAPIExpression for parsed expressions and JSONValue for introspection data, remove this FIXME as no longer an action item. A third JSON-y data type, _ExprValue, is not meant to represent JSON in the abstract but rather only the possible legal return values from a single function, get_expr(). It isn't appropriate to attempt to merge it with either of the above two types. In theory, it may be possible to define a completely agnostic one-size-fits-all JSON type hierarchy that any other user could borrow - in practice, it's tough to wrangle the differences between invariant, covariant and contravariant types: input and output parameters demand different properties of such a structure. However, QAPIExpression serves to authoritatively type user input to the QAPI parser, while JSONValue serves to authoritatively type qapi generator *output* to be served back to client users at runtime via QMP. The AST for these two types are different and cannot be wholly merged into a unified syntax. They could, in theory, share some JSON primitive definitions. In practice, this is currently more trouble than it's worth with mypy's current expressive power. As such, declare this "done enough for now". Signed-off-by: John Snow Message-Id: <20230215000011.1725012-7-jsnow@redhat.com> Reviewed-by: Markus Armbruster --- scripts/qapi/parser.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index d570086e1a..878f90b458 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -42,10 +42,6 @@ _ExprValue =3D Union[List[object], Dict[str, object], str, bool] =20 =20 -# FIXME: Consolidate and centralize definitions for _ExprValue and -# JSONValue; currently scattered across several modules. - - class QAPIExpression(Dict[str, object]): # pylint: disable=3Dtoo-few-public-methods def __init__(self, --=20 2.39.0