From nobody Tue Nov 4 13:04:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504189749193774.1409628119771; Thu, 31 Aug 2017 07:29:09 -0700 (PDT) Received: from localhost ([::1]:56058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnQSx-0003F2-5k for importer@patchew.org; Thu, 31 Aug 2017 10:29:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnQOi-0007tO-Mp for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnQOh-0007bh-Hn for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnQOh-0007bP-8h for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:43 -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 mx1.redhat.com (Postfix) with ESMTPS id 4B59D81DEE; Thu, 31 Aug 2017 14:24:42 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696FA7BAE3; Thu, 31 Aug 2017 14:24:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B59D81DEE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=berrange@redhat.com From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Thu, 31 Aug 2017 15:24:27 +0100 Message-Id: <20170831142430.16665-3-berrange@redhat.com> In-Reply-To: <20170831142430.16665-1-berrange@redhat.com> References: <20170831142430.16665-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 31 Aug 2017 14:24:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/5] qapi: use items()/values() intead of iteritems()/itervalues() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The iteritems()/itervalues() methods are gone in py3, but the items()/values() methods are still around. The latter are less efficient than the former in py2, but this has unmeasurably small impact on QEMU build time, so taking portability over efficiency is a net win Signed-off-by: Daniel P. Berrange --- scripts/qapi.py | 12 ++++++------ scripts/qapi2texi.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index a60b79c126..d89af7d6c6 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -253,7 +253,7 @@ class QAPIDoc(object): "'Returns:' is only valid for commands") =20 def check(self): - bogus =3D [name for name, section in self.args.iteritems() + bogus =3D [name for name, section in self.args.items() if not section.member] if bogus: raise QAPISemError( @@ -309,7 +309,7 @@ class QAPISchemaParser(object): if not isinstance(pragma, dict): raise QAPISemError( info, "Value of 'pragma' must be a dictionary") - for name, value in pragma.iteritems(): + for name, value in pragma.items(): self._pragma(name, value, info) else: expr_elem =3D {'expr': expr, @@ -1575,7 +1575,7 @@ class QAPISchema(object): =20 def _make_members(self, data, info): return [self._make_member(key, value, info) - for (key, value) in data.iteritems()] + for (key, value) in data.items()] =20 def _def_struct_type(self, expr, info, doc): name =3D expr['struct'] @@ -1607,11 +1607,11 @@ class QAPISchema(object): name, info, doc, 'base', self._make_members(base, info))) if tag_name: variants =3D [self._make_variant(key, value) - for (key, value) in data.iteritems()] + for (key, value) in data.items()] members =3D [] else: variants =3D [self._make_simple_variant(key, value, info) - for (key, value) in data.iteritems()] + for (key, value) in data.items()] typ =3D self._make_implicit_enum_type(name, info, [v.name for v in variants]) tag_member =3D QAPISchemaObjectTypeMember('type', typ, False) @@ -1626,7 +1626,7 @@ class QAPISchema(object): name =3D expr['alternate'] data =3D expr['data'] variants =3D [self._make_variant(key, value) - for (key, value) in data.iteritems()] + for (key, value) in data.items()] tag_member =3D QAPISchemaObjectTypeMember('type', 'QType', False) self._def_entity( QAPISchemaAlternateType(name, info, doc, diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 9c57b01bb4..bc43edabd7 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -148,7 +148,7 @@ def texi_member(member, suffix=3D''): def texi_members(doc, what, base, variants, member_func): """Format the table of members""" items =3D '' - for section in doc.args.itervalues(): + for section in doc.args.values(): # TODO Drop fallbacks when undocumented members are outlawed if section.content: desc =3D texi_format(str(section)) --=20 2.13.5