From nobody Fri Oct 10 08:22:29 2025 Delivered-To: importer@patchew.org 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; 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=1583412329; cv=none; d=zohomail.com; s=zohoarc; b=m26vEKN47ohAs8OYp4J/eSWyVvFONHrhhOYjMhbpKNHGYomIVtys37SQqw0lyXgA9U7ubYogtiPpeG/U/V0QyZL7AZZIH0zoIRvcbI3BIiAm8fZ8fJ+wh/qibox7v71AWWglLfxvSr5CPY0eZ7JRi1G6j7maRNKbko6HxwiTuMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412329; 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=4exrPZOJNMef6nN6je51jTkgSw58nU82U5HDJmrY3kE=; b=LF1/pmoo/hyEHh+1uR1wTYphTBH5dBv7VXWWRqBrreAiXnRdBlQvufcEFsOfKQ5l87ApnZhhcsi76j25dgdT3QYTy0Z/XIC4ENSwSB96sByLMH9zxqlAKMYmCM3UsC9rQoYLLK1K02z89c1lTf2BFFqFs+mzne/Ae4B9vK4hlbw= 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 1583412329924634.9699379750352; Thu, 5 Mar 2020 04:45:29 -0800 (PST) Received: from localhost ([::1]:48264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9psW-0004km-MM for importer@patchew.org; Thu, 05 Mar 2020 07:45:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41251) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pr0-0002vD-Pl for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pqz-0000A7-GR for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:54 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53317 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9pqz-00009I-Ci for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:53 -0500 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-376-hCVcS44RNtmL40m7GByPsQ-1; Thu, 05 Mar 2020 07:43:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C10EC1088386 for ; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-129.ams2.redhat.com [10.36.116.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48DEF5C221; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CA5D211385ED; Thu, 5 Mar 2020 13:43:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412232; 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=4exrPZOJNMef6nN6je51jTkgSw58nU82U5HDJmrY3kE=; b=gamh1UNmhSNlUHcBE8BY/b1urDFsdu07GzDN/wXHMa5j+U3ZU6+TQGyhc8Hg1vf8fRuKCT QJrRgc1aDxcdRo5sEL1FsHmfVCmZOIW0XWMZZ3330ImDZXtmAmgyuHsWk6TWqxj7Yzuyn/ uXcMgCdv7PFfwwlYoyRuW0iiY5uAoXc= X-MC-Unique: hCVcS44RNtmL40m7GByPsQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 1/4] qapi: Inheriting from object is pointless with Python 3, drop Date: Thu, 5 Mar 2020 13:43:43 +0100 Message-Id: <20200305124346.22053-2-armbru@redhat.com> In-Reply-To: <20200305124346.22053-1-armbru@redhat.com> References: <20200305124346.22053-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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: John Snow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200304155932.20452-2-armbru@redhat.com> Reviewed-by: John Snow --- scripts/qapi/gen.py | 2 +- scripts/qapi/parser.py | 6 +++--- scripts/qapi/schema.py | 12 ++++++------ scripts/qapi/source.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 95afae0615..a53a705c73 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -22,7 +22,7 @@ from qapi.common import * from qapi.schema import QAPISchemaVisitor =20 =20 -class QAPIGen(object): +class QAPIGen: =20 def __init__(self, fname): self.fname =3D fname diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 342792e410..2e3a3c5d76 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -23,7 +23,7 @@ from qapi.error import QAPIParseError, QAPISemError from qapi.source import QAPISourceInfo =20 =20 -class QAPISchemaParser(object): +class QAPISchemaParser: =20 def __init__(self, fname, previously_included=3DNone, incl_info=3DNone= ): previously_included =3D previously_included or set() @@ -293,7 +293,7 @@ class QAPISchemaParser(object): raise QAPIParseError(self, "documentation comment must end with '#= #'") =20 =20 -class QAPIDoc(object): +class QAPIDoc: """ A documentation comment block, either definition or free-form =20 @@ -312,7 +312,7 @@ class QAPIDoc(object): Free-form documentation blocks consist only of a body section. """ =20 - class Section(object): + class Section: def __init__(self, name=3DNone): # optional section name (argument/member or section name) self.name =3D name diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 5100110fa2..c8bcfe2c49 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -24,7 +24,7 @@ from qapi.expr import check_exprs from qapi.parser import QAPISchemaParser =20 =20 -class QAPISchemaEntity(object): +class QAPISchemaEntity: meta =3D None =20 def __init__(self, name, info, doc, ifcond=3DNone, features=3DNone): @@ -89,7 +89,7 @@ class QAPISchemaEntity(object): return "%s '%s'" % (self.meta, self.name) =20 =20 -class QAPISchemaVisitor(object): +class QAPISchemaVisitor: def visit_begin(self, schema): pass =20 @@ -135,7 +135,7 @@ class QAPISchemaVisitor(object): pass =20 =20 -class QAPISchemaModule(object): +class QAPISchemaModule: def __init__(self, name): self.name =3D name self._entity_list =3D [] @@ -441,7 +441,7 @@ class QAPISchemaObjectType(QAPISchemaType): self.features) =20 =20 -class QAPISchemaMember(object): +class QAPISchemaMember: """ Represents object members, enum members and features """ role =3D 'member' =20 @@ -519,7 +519,7 @@ class QAPISchemaObjectTypeMember(QAPISchemaMember): self.describe) =20 =20 -class QAPISchemaObjectTypeVariants(object): +class QAPISchemaObjectTypeVariants: def __init__(self, tag_name, info, tag_member, variants): # Flat unions pass tag_name but not tag_member. # Simple unions and alternates pass tag_member but not tag_name. @@ -787,7 +787,7 @@ class QAPISchemaEvent(QAPISchemaEntity): self.arg_type, self.boxed) =20 =20 -class QAPISchema(object): +class QAPISchema: def __init__(self, fname): self.fname =3D fname parser =3D QAPISchemaParser(fname) diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py index 8956885033..e97b9a8e15 100644 --- a/scripts/qapi/source.py +++ b/scripts/qapi/source.py @@ -13,7 +13,7 @@ import copy import sys =20 =20 -class QAPISchemaPragma(object): +class QAPISchemaPragma: def __init__(self): # Are documentation comments required? self.doc_required =3D False @@ -23,7 +23,7 @@ class QAPISchemaPragma(object): self.name_case_whitelist =3D [] =20 =20 -class QAPISourceInfo(object): +class QAPISourceInfo: def __init__(self, fname, line, parent): self.fname =3D fname self.line =3D line --=20 2.21.1 From nobody Fri Oct 10 08:22:29 2025 Delivered-To: importer@patchew.org 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; 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=1583412321; cv=none; d=zohomail.com; s=zohoarc; b=ed/qoMqQ5oQJ/zlesq/D9OtYXzyC60dQlcsDQlofMtyHHuSVkKugjaXqvbP0Hf8QmyZlFlZejIPbpjsydy83P8p1LfJ5Ax1pAjNtO6tstJxKO2+rvsjBGTRlF2YPIZNyd69z4mxUFpJLfnVySGY5qToOCYNwEh3AL3zICT/6odA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412321; 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=m8yoR1094jzagrJ9i9zqtQKPJXIlBZneSAkTzXgoB60=; b=j5L8/dLuMiAwsabd+Kl/rJavqiy4yFogUQjl7oLi6jBtAYY8Lo7To8vBwtFLEeoxJxV1wgAQLfXP4s/tuNE7K+BDQPtxwoeRXh/zR+L0zMAYIpKOzLyF7nED6t816bxfrwVSYl6NuEaqBIZydjdTSZI3qoIYEz/uTJhy2b9dOAs= 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 1583412321436278.94070932177203; Thu, 5 Mar 2020 04:45:21 -0800 (PST) Received: from localhost ([::1]:48256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9psO-0004RU-1X for importer@patchew.org; Thu, 05 Mar 2020 07:45:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41230) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pqz-0002vA-LC for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pqy-00009L-HE for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:53 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:57881 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9pqy-00008t-Do for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:52 -0500 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-401-sajFWaxyPWuBMN2ySFhKdg-1; Thu, 05 Mar 2020 07:43:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91500107BA9C for ; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-129.ams2.redhat.com [10.36.116.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D12B5C28D; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CD67811385F4; Thu, 5 Mar 2020 13:43:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412232; 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=m8yoR1094jzagrJ9i9zqtQKPJXIlBZneSAkTzXgoB60=; b=GXbgLjsZWyadg6lNaPqnLmQgNXW7nTaVZ/W7M1E0dC0nu0jdr2BPZw6eYleaN9etaELeFc Z0lXobsy/PE0qFgmYy6jt1VTM+NP74sPuwsClQcOVpUDKEfozsxGgbz5nYbqtDS2VSdryI KKbOwBz2D+endR/hL+fdjoRPpyTKRWs= X-MC-Unique: sajFWaxyPWuBMN2ySFhKdg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 2/4] qapi: Drop conditionals for Python 2 Date: Thu, 5 Mar 2020 13:43:44 +0100 Message-Id: <20200305124346.22053-3-armbru@redhat.com> In-Reply-To: <20200305124346.22053-1-armbru@redhat.com> References: <20200305124346.22053-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: John Snow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200304155932.20452-3-armbru@redhat.com> Reviewed-by: John Snow --- scripts/qapi/common.py | 6 +----- scripts/qapi/gen.py | 6 +----- scripts/qapi/parser.py | 6 +----- tests/qapi-schema/test-qapi.py | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index e00dcafce7..ba35abea47 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -12,7 +12,6 @@ # See the COPYING file in the top-level directory. =20 import re -import string =20 =20 # ENUMName -> ENUM_NAME, EnumName1 -> ENUM_NAME1 @@ -43,10 +42,7 @@ def c_enum_const(type_name, const_name, prefix=3DNone): return camel_to_upper(type_name) + '_' + c_name(const_name, False).upp= er() =20 =20 -if hasattr(str, 'maketrans'): - c_name_trans =3D str.maketrans('.-', '__') -else: - c_name_trans =3D string.maketrans('.-', '__') +c_name_trans =3D str.maketrans('.-', '__') =20 =20 # Map @name to a valid C identifier. diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index a53a705c73..317cd72601 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -15,7 +15,6 @@ import errno import os import re -import sys from contextlib import contextmanager =20 from qapi.common import * @@ -54,10 +53,7 @@ class QAPIGen: if e.errno !=3D errno.EEXIST: raise fd =3D os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666) - if sys.version_info[0] >=3D 3: - f =3D open(fd, 'r+', encoding=3D'utf-8') - else: - f =3D os.fdopen(fd, 'r+') + f =3D open(fd, 'r+', encoding=3D'utf-8') text =3D self.get_content() oldtext =3D f.read(len(text) + 1) if text !=3D oldtext: diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 2e3a3c5d76..cf14e5426c 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -16,7 +16,6 @@ =20 import os import re -import sys from collections import OrderedDict =20 from qapi.error import QAPIParseError, QAPISemError @@ -30,10 +29,7 @@ class QAPISchemaParser: previously_included.add(os.path.abspath(fname)) =20 try: - if sys.version_info[0] >=3D 3: - fp =3D open(fname, 'r', encoding=3D'utf-8') - else: - fp =3D open(fname, 'r') + fp =3D open(fname, 'r', encoding=3D'utf-8') self.src =3D fp.read() except IOError as e: raise QAPISemError(incl_info or QAPISourceInfo(None, None, Non= e), diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 41232c11a3..bee18ee344 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -16,15 +16,11 @@ import argparse import difflib import os import sys +from io import StringIO =20 from qapi.error import QAPIError from qapi.schema import QAPISchema, QAPISchemaVisitor =20 -if sys.version_info[0] < 3: - from cStringIO import StringIO -else: - from io import StringIO - =20 class QAPISchemaTestVisitor(QAPISchemaVisitor): =20 --=20 2.21.1 From nobody Fri Oct 10 08:22:29 2025 Delivered-To: importer@patchew.org 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; 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=1583412551; cv=none; d=zohomail.com; s=zohoarc; b=WWFhxxPDnl/J9tXNaIOk64q9zoN2kIGCEeOy6XvUcMCDmII5u/7JIJEmJuRoiqE2yPlYYFlzYOvB/yP/JKjCxl7SV70O2apDQTgsQ+agOTAnBJVvQfOYmOxzyCdTSZsjkQpeQhKC5xWTPQ9uzSgEoxfOJYrGMl7h9hsXap/d4/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412551; 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=7PDmCbemNPLfd7XmHtjZdPpxdJ0ljHTd4lQjMHVTBlc=; b=lDso9PMK/809St1Can25+03ACn1aZphL3GJwyh3nagLIIkLoqON5xhH4rdGw0O/DwMN9tThRllv6Licp+fh5VY1qfi0emRchvEJomf+XL22py61jugN1/XXiaPJqfkVCYfyxairGPnNrfExl2HO5hn/iuL+1mr6SO5W1frPEcHc= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583412551393757.3898088226572; Thu, 5 Mar 2020 04:49:11 -0800 (PST) Received: from localhost ([::1]:48372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pw6-000403-4n for importer@patchew.org; Thu, 05 Mar 2020 07:49:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41292) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pr6-0002vl-Gr for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:44:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pr4-0000Gr-CE for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:44:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49989 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9pr4-0000Fr-7l for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:58 -0500 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-351-bz8Gw8L8NMaBllSeMvow5Q-1; Thu, 05 Mar 2020 07:43:51 -0500 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 9DCCC1007277 for ; Thu, 5 Mar 2020 12:43:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-129.ams2.redhat.com [10.36.116.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F8655D9C9; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D0CD01138611; Thu, 5 Mar 2020 13:43:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412237; 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=7PDmCbemNPLfd7XmHtjZdPpxdJ0ljHTd4lQjMHVTBlc=; b=IFqilPbTcBpialRWfdRiFzz6NefzxcnJDa9dRgQaENk7JJXLL3fAimiTmMTyW6nT+4HNoo tXnNyP+z5Tkh9GYpvSHO8+bo0ARDtuHnYogGfLie4BIc8Zqkx5KV48+Rx+uiImj7Q6zmOC m/WutDsh4Vd4DouHV9cM4PQJtH8X4cg= X-MC-Unique: bz8Gw8L8NMaBllSeMvow5Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 3/4] qapi: Use super() now we have Python 3 Date: Thu, 5 Mar 2020 13:43:45 +0100 Message-Id: <20200305124346.22053-4-armbru@redhat.com> In-Reply-To: <20200305124346.22053-1-armbru@redhat.com> References: <20200305124346.22053-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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: John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Message-Id: <20200304155932.20452-4-armbru@redhat.com> Reviewed-by: John Snow --- scripts/qapi/commands.py | 4 +-- scripts/qapi/error.py | 4 +-- scripts/qapi/events.py | 4 +-- scripts/qapi/gen.py | 10 ++++---- scripts/qapi/introspect.py | 4 +-- scripts/qapi/parser.py | 2 +- scripts/qapi/schema.py | 51 +++++++++++++++++++------------------- scripts/qapi/types.py | 4 +-- scripts/qapi/visit.py | 4 +-- 9 files changed, 43 insertions(+), 44 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index afa55b055c..8bb6316061 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -237,8 +237,8 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds) class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): =20 def __init__(self, prefix): - QAPISchemaModularCVisitor.__init__( - self, prefix, 'qapi-commands', + super().__init__( + prefix, 'qapi-commands', ' * Schema-defined QAPI/QMP commands', None, __doc__) self._regy =3D QAPIGenCCode(None) self._visited_ret_types =3D {} diff --git a/scripts/qapi/error.py b/scripts/qapi/error.py index b9f3751bea..ae60d9e2fe 100644 --- a/scripts/qapi/error.py +++ b/scripts/qapi/error.py @@ -35,9 +35,9 @@ class QAPIParseError(QAPIError): col =3D (col + 7) % 8 + 1 else: col +=3D 1 - QAPIError.__init__(self, parser.info, col, msg) + super().__init__(parser.info, col, msg) =20 =20 class QAPISemError(QAPIError): def __init__(self, info, msg): - QAPIError.__init__(self, info, None, msg) + super().__init__(info, None, msg) diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 2bde3e6128..a98b9f5099 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -138,8 +138,8 @@ def gen_event_send(name, arg_type, boxed, event_enum_na= me, event_emit): class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): =20 def __init__(self, prefix): - QAPISchemaModularCVisitor.__init__( - self, prefix, 'qapi-events', + super().__init__( + prefix, 'qapi-events', ' * Schema-defined QAPI/QMP events', None, __doc__) self._event_enum_name =3D c_name(prefix + 'QAPIEvent', protect=3DF= alse) self._event_enum_members =3D [] diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 317cd72601..e17354392b 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -82,7 +82,7 @@ def _wrap_ifcond(ifcond, before, after): class QAPIGenCCode(QAPIGen): =20 def __init__(self, fname): - QAPIGen.__init__(self, fname) + super().__init__(fname) self._start_if =3D None =20 def start_if(self, ifcond): @@ -102,13 +102,13 @@ class QAPIGenCCode(QAPIGen): =20 def get_content(self): assert self._start_if is None - return QAPIGen.get_content(self) + return super().get_content() =20 =20 class QAPIGenC(QAPIGenCCode): =20 def __init__(self, fname, blurb, pydoc): - QAPIGenCCode.__init__(self, fname) + super().__init__(fname) self._blurb =3D blurb self._copyright =3D '\n * '.join(re.findall(r'^Copyright .*', pydo= c, re.MULTILINE)) @@ -141,7 +141,7 @@ char qapi_dummy_%(name)s; class QAPIGenH(QAPIGenC): =20 def _top(self): - return QAPIGenC._top(self) + guardstart(self.fname) + return super()._top() + guardstart(self.fname) =20 def _bottom(self): return guardend(self.fname) @@ -176,7 +176,7 @@ def ifcontext(ifcond, *args): class QAPIGenDoc(QAPIGen): =20 def _top(self): - return (QAPIGen._top(self) + return (super()._top() + '@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n') =20 =20 diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index b3a463dd8b..0cc655fd9f 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -76,8 +76,8 @@ def to_c_string(string): class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor): =20 def __init__(self, prefix, unmask): - QAPISchemaMonolithicCVisitor.__init__( - self, prefix, 'qapi-introspect', + super().__init__( + prefix, 'qapi-introspect', ' * QAPI/QMP schema introspection', __doc__) self._unmask =3D unmask self._schema =3D None diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index cf14e5426c..340f7c4633 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -320,7 +320,7 @@ class QAPIDoc: =20 class ArgSection(Section): def __init__(self, name): - QAPIDoc.Section.__init__(self, name) + super().__init__(name) self.member =3D None =20 def connect(self, member): diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c8bcfe2c49..87837e224e 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -152,11 +152,11 @@ class QAPISchemaModule: =20 class QAPISchemaInclude(QAPISchemaEntity): def __init__(self, sub_module, info): - QAPISchemaEntity.__init__(self, None, info, None) + super().__init__(None, info, None) self._sub_module =3D sub_module =20 def visit(self, visitor): - QAPISchemaEntity.visit(self, visitor) + super().visit(visitor) visitor.visit_include(self._sub_module.name, self.info) =20 =20 @@ -202,7 +202,7 @@ class QAPISchemaBuiltinType(QAPISchemaType): meta =3D 'built-in' =20 def __init__(self, name, json_type, c_type): - QAPISchemaType.__init__(self, name, None, None) + super().__init__(name, None, None) assert not c_type or isinstance(c_type, str) assert json_type in ('string', 'number', 'int', 'boolean', 'null', 'value') @@ -227,7 +227,7 @@ class QAPISchemaBuiltinType(QAPISchemaType): return self.json_type() =20 def visit(self, visitor): - QAPISchemaType.visit(self, visitor) + super().visit(visitor) visitor.visit_builtin_type(self.name, self.info, self.json_type()) =20 =20 @@ -235,7 +235,7 @@ class QAPISchemaEnumType(QAPISchemaType): meta =3D 'enum' =20 def __init__(self, name, info, doc, ifcond, members, prefix): - QAPISchemaType.__init__(self, name, info, doc, ifcond) + super().__init__(name, info, doc, ifcond) for m in members: assert isinstance(m, QAPISchemaEnumMember) m.set_defined_in(name) @@ -244,7 +244,7 @@ class QAPISchemaEnumType(QAPISchemaType): self.prefix =3D prefix =20 def check(self, schema): - QAPISchemaType.check(self, schema) + super().check(schema) seen =3D {} for m in self.members: m.check_clash(self.info, seen) @@ -269,7 +269,7 @@ class QAPISchemaEnumType(QAPISchemaType): return 'string' =20 def visit(self, visitor): - QAPISchemaType.visit(self, visitor) + super().visit(visitor) visitor.visit_enum_type(self.name, self.info, self.ifcond, self.members, self.prefix) =20 @@ -278,13 +278,13 @@ class QAPISchemaArrayType(QAPISchemaType): meta =3D 'array' =20 def __init__(self, name, info, element_type): - QAPISchemaType.__init__(self, name, info, None, None) + super().__init__(name, info, None, None) assert isinstance(element_type, str) self._element_type_name =3D element_type self.element_type =3D None =20 def check(self, schema): - QAPISchemaType.check(self, schema) + super().check(schema) self.element_type =3D schema.resolve_type( self._element_type_name, self.info, self.info and self.info.defn_meta) @@ -314,7 +314,7 @@ class QAPISchemaArrayType(QAPISchemaType): return 'array of ' + elt_doc_type =20 def visit(self, visitor): - QAPISchemaType.visit(self, visitor) + super().visit(visitor) visitor.visit_array_type(self.name, self.info, self.ifcond, self.element_type) =20 @@ -329,7 +329,7 @@ class QAPISchemaObjectType(QAPISchemaType): # struct has local_members, optional base, and no variants # flat union has base, variants, and no local_members # simple union has local_members, variants, and no base - QAPISchemaType.__init__(self, name, info, doc, ifcond, features) + super().__init__(name, info, doc, ifcond, features) self.meta =3D 'union' if variants else 'struct' assert base is None or isinstance(base, str) for m in local_members: @@ -356,7 +356,7 @@ class QAPISchemaObjectType(QAPISchemaType): raise QAPISemError(self.info, "object %s contains itself" % self.name) =20 - QAPISchemaType.check(self, schema) + super().check(schema) assert self._checked and self.members is None =20 seen =3D OrderedDict() @@ -419,7 +419,7 @@ class QAPISchemaObjectType(QAPISchemaType): =20 def c_name(self): assert self.name !=3D 'q_empty' - return QAPISchemaType.c_name(self) + return super().c_name() =20 def c_type(self): assert not self.is_implicit() @@ -432,7 +432,7 @@ class QAPISchemaObjectType(QAPISchemaType): return 'object' =20 def visit(self, visitor): - QAPISchemaType.visit(self, visitor) + super().visit(visitor) visitor.visit_object_type(self.name, self.info, self.ifcond, self.base, self.local_members, self.vari= ants, self.features) @@ -506,7 +506,7 @@ class QAPISchemaFeature(QAPISchemaMember): =20 class QAPISchemaObjectTypeMember(QAPISchemaMember): def __init__(self, name, info, typ, optional, ifcond=3DNone): - QAPISchemaMember.__init__(self, name, info, ifcond) + super().__init__(name, info, ifcond) assert isinstance(typ, str) assert isinstance(optional, bool) self._type_name =3D typ @@ -614,15 +614,14 @@ class QAPISchemaObjectTypeVariant(QAPISchemaObjectTyp= eMember): role =3D 'branch' =20 def __init__(self, name, info, typ, ifcond=3DNone): - QAPISchemaObjectTypeMember.__init__(self, name, info, typ, - False, ifcond) + super().__init__(name, info, typ, False, ifcond) =20 =20 class QAPISchemaAlternateType(QAPISchemaType): meta =3D 'alternate' =20 def __init__(self, name, info, doc, ifcond, variants): - QAPISchemaType.__init__(self, name, info, doc, ifcond) + super().__init__(name, info, doc, ifcond) assert isinstance(variants, QAPISchemaObjectTypeVariants) assert variants.tag_member variants.set_defined_in(name) @@ -630,7 +629,7 @@ class QAPISchemaAlternateType(QAPISchemaType): self.variants =3D variants =20 def check(self, schema): - QAPISchemaType.check(self, schema) + super().check(schema) self.variants.tag_member.check(schema) # Not calling self.variants.check_clash(), because there's nothing # to clash with @@ -680,7 +679,7 @@ class QAPISchemaAlternateType(QAPISchemaType): return 'value' =20 def visit(self, visitor): - QAPISchemaType.visit(self, visitor) + super().visit(visitor) visitor.visit_alternate_type(self.name, self.info, self.ifcond, self.variants) =20 @@ -691,7 +690,7 @@ class QAPISchemaCommand(QAPISchemaEntity): def __init__(self, name, info, doc, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig, features): - QAPISchemaEntity.__init__(self, name, info, doc, ifcond, features) + super().__init__(name, info, doc, ifcond, features) assert not arg_type or isinstance(arg_type, str) assert not ret_type or isinstance(ret_type, str) self._arg_type_name =3D arg_type @@ -705,7 +704,7 @@ class QAPISchemaCommand(QAPISchemaEntity): self.allow_preconfig =3D allow_preconfig =20 def check(self, schema): - QAPISchemaEntity.check(self, schema) + super().check(schema) if self._arg_type_name: self.arg_type =3D schema.resolve_type( self._arg_type_name, self.info, "command's 'data'") @@ -740,7 +739,7 @@ class QAPISchemaCommand(QAPISchemaEntity): self.arg_type.connect_doc(doc) =20 def visit(self, visitor): - QAPISchemaEntity.visit(self, visitor) + super().visit(visitor) visitor.visit_command(self.name, self.info, self.ifcond, self.arg_type, self.ret_type, self.gen, self.success_response, @@ -753,14 +752,14 @@ class QAPISchemaEvent(QAPISchemaEntity): meta =3D 'event' =20 def __init__(self, name, info, doc, ifcond, arg_type, boxed): - QAPISchemaEntity.__init__(self, name, info, doc, ifcond) + super().__init__(name, info, doc, ifcond) assert not arg_type or isinstance(arg_type, str) self._arg_type_name =3D arg_type self.arg_type =3D None self.boxed =3D boxed =20 def check(self, schema): - QAPISchemaEntity.check(self, schema) + super().check(schema) if self._arg_type_name: self.arg_type =3D schema.resolve_type( self._arg_type_name, self.info, "event's 'data'") @@ -782,7 +781,7 @@ class QAPISchemaEvent(QAPISchemaEntity): self.arg_type.connect_doc(doc) =20 def visit(self, visitor): - QAPISchemaEntity.visit(self, visitor) + super().visit(visitor) visitor.visit_event(self.name, self.info, self.ifcond, self.arg_type, self.boxed) =20 diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 99dcaf7074..3c83b6e4be 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -241,8 +241,8 @@ void qapi_free_%(c_name)s(%(c_name)s *obj) class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor): =20 def __init__(self, prefix): - QAPISchemaModularCVisitor.__init__( - self, prefix, 'qapi-types', ' * Schema-defined QAPI types', + super().__init__( + prefix, 'qapi-types', ' * Schema-defined QAPI types', ' * Built-in QAPI types', __doc__) =20 def _begin_system_module(self, name): diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 4efce62b0c..421e5bd8cd 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -283,8 +283,8 @@ out: class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor): =20 def __init__(self, prefix): - QAPISchemaModularCVisitor.__init__( - self, prefix, 'qapi-visit', ' * Schema-defined QAPI visitors', + super().__init__( + prefix, 'qapi-visit', ' * Schema-defined QAPI visitors', ' * Built-in QAPI visitors', __doc__) =20 def _begin_system_module(self, name): --=20 2.21.1 From nobody Fri Oct 10 08:22:29 2025 Delivered-To: importer@patchew.org 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; 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=1583412340; cv=none; d=zohomail.com; s=zohoarc; b=d8s7sukkJSGiTHwEm4iZR8J80PVXXI+DeCc3jy55ih0KbBWrXb87a/exClXSmIqWhhfsigYDAI8WBFdB0v6N55vcR8iVBwAJn0HREe9AzedZtlpu5xPAtWp8Wpn5QghCC9v68U7DlQEoue76sdKu6OBczQSm8QLVNRaKIP+YHlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412340; 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=J8mhNEgNEnlIU+Fo+21yo3liYk+LW4qcV4nXDwG3ntY=; b=JLolxYhju65/ukdBhl4K8d71y8TVJLXis38xr8JOrDmbRjehluSddKoqA1NNfPUvjmenosevMpiG6PQldxKz2+nxiuCC+FWyjUmQD/RlqgRO/6AH2KJEQclA1h6a6rvP3kkK4VfuoK1oKcMFcl33iPcZE2mIznAh8g1cw0i+m1A= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583412340749204.53270003017815; Thu, 5 Mar 2020 04:45:40 -0800 (PST) Received: from localhost ([::1]:48267 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9psh-0005E1-JQ for importer@patchew.org; Thu, 05 Mar 2020 07:45:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pr0-0002vI-Sa for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pqz-0000A0-EH for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:54 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:44012 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9pqz-00009R-Ab for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:43:53 -0500 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-328-k_nP0fkKM3yZYXKd5me4bw-1; Thu, 05 Mar 2020 07:43:49 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2BF113EA for ; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-129.ams2.redhat.com [10.36.116.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 546AD94B41; Thu, 5 Mar 2020 12:43:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D440A11366CB; Thu, 5 Mar 2020 13:43:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412232; 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=J8mhNEgNEnlIU+Fo+21yo3liYk+LW4qcV4nXDwG3ntY=; b=NHxql1ZnWO5PJcUXhfMvdD/uB9BIqIdJSxd20/9e9//vhAT0NFpYfPey7nN8lzX2IMsbjt chCBxlqx93XoU6InFIiXmb+MTgS30pf2ufmNEzGS85yPkkVoftl8o732wpd5w1aPyqdpNq kUo9MeZKAsnCgdKz95zAsZiXHBqTY5k= X-MC-Unique: k_nP0fkKM3yZYXKd5me4bw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 4/4] qapi: Brush off some (py)lint Date: Thu, 5 Mar 2020 13:43:46 +0100 Message-Id: <20200305124346.22053-5-armbru@redhat.com> In-Reply-To: <20200305124346.22053-1-armbru@redhat.com> References: <20200305124346.22053-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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: John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Message-Id: <20200304155932.20452-5-armbru@redhat.com> Reviewed-by: John Snow --- scripts/qapi/commands.py | 2 +- scripts/qapi/expr.py | 3 +-- scripts/qapi/gen.py | 9 ++++++--- scripts/qapi/introspect.py | 2 -- scripts/qapi/parser.py | 6 ++---- scripts/qapi/schema.py | 11 +++++------ 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 8bb6316061..0e13e82989 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -274,7 +274,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVis= itor): =20 void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds); ''', - c_prefix=3Dc_name(self._prefix, protect=3DFalse))) + c_prefix=3Dc_name(self._prefix, protect=3DFal= se))) self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "%(prefix)sqapi-commands.h" diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index d7a289eded..fecf466fa7 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -35,7 +35,6 @@ def check_name_is_str(name, info, source): def check_name_str(name, info, source, allow_optional=3DFalse, enum_member=3DFalse, permit_upper=3DFalse): - global valid_name membername =3D name =20 if allow_optional and name.startswith('*'): @@ -249,7 +248,7 @@ def check_union(expr, info): def check_alternate(expr, info): members =3D expr['data'] =20 - if len(members) =3D=3D 0: + if not members: raise QAPISemError(info, "'data' must not be empty") for (key, value) in members.items(): source =3D "'data' member '%s'" % key diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index e17354392b..33690bfa3b 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -45,10 +45,10 @@ class QAPIGen: =20 def write(self, output_dir): pathname =3D os.path.join(output_dir, self.fname) - dir =3D os.path.dirname(pathname) - if dir: + odir =3D os.path.dirname(pathname) + if odir: try: - os.makedirs(dir) + os.makedirs(odir) except os.error as e: if e.errno !=3D errno.EEXIST: raise @@ -261,6 +261,9 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor): genc.write(output_dir) genh.write(output_dir) =20 + def _begin_system_module(self, name): + pass + def _begin_user_module(self, name): pass =20 diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 0cc655fd9f..b5537eddc0 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -10,8 +10,6 @@ This work is licensed under the terms of the GNU GPL, ver= sion 2. See the COPYING file in the top-level directory. """ =20 -import string - from qapi.common import * from qapi.gen import QAPISchemaMonolithicCVisitor from qapi.schema import (QAPISchemaArrayType, QAPISchemaBuiltinType, diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 340f7c4633..abadacbb0e 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -282,8 +282,7 @@ class QAPISchemaParser: doc.end_comment() self.accept() return doc - else: - doc.append(self.val) + doc.append(self.val) self.accept(False) =20 raise QAPIParseError(self, "documentation comment must end with '#= #'") @@ -492,7 +491,7 @@ class QAPIDoc: raise QAPIParseError(self._parser, "'%s' can't follow '%s' section" % (name, self.sections[0].name)) - elif self._is_section_tag(name): + if self._is_section_tag(name): line =3D line[len(name)+1:] self._start_section(name[:-1]) =20 @@ -556,7 +555,6 @@ class QAPIDoc: raise QAPISemError(feature.info, "feature '%s' lacks documentation" % feature.name) - self.features[feature.name] =3D QAPIDoc.ArgSection(feature.nam= e) self.features[feature.name].connect(feature) =20 def check_expr(self, expr): diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 87837e224e..d759308b4e 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -19,7 +19,7 @@ import re from collections import OrderedDict =20 from qapi.common import c_name, pointer_suffix -from qapi.error import QAPIError, QAPIParseError, QAPISemError +from qapi.error import QAPIError, QAPISemError from qapi.expr import check_exprs from qapi.parser import QAPISchemaParser =20 @@ -96,14 +96,14 @@ class QAPISchemaVisitor: def visit_end(self): pass =20 - def visit_module(self, fname): + def visit_module(self, name): pass =20 def visit_needed(self, entity): # Default to visiting everything return True =20 - def visit_include(self, fname, info): + def visit_include(self, name, info): pass =20 def visit_builtin_type(self, name, info, json_type): @@ -576,7 +576,7 @@ class QAPISchemaObjectTypeVariants: assert self.tag_member.ifcond =3D=3D [] if self._tag_name: # flat union # branches that are not explicitly covered get an empty type - cases =3D set([v.name for v in self.variants]) + cases =3D {v.name for v in self.variants} for m in self.tag_member.type.members: if m.name not in cases: v =3D QAPISchemaObjectTypeVariant(m.name, self.info, @@ -848,7 +848,7 @@ class QAPISchema: =20 def _make_module(self, fname): name =3D self._module_name(fname) - if not name in self._module_dict: + if name not in self._module_dict: self._module_dict[name] =3D QAPISchemaModule(name) return self._module_dict[name] =20 @@ -1097,7 +1097,6 @@ class QAPISchema: =20 def visit(self, visitor): visitor.visit_begin(self) - module =3D None for mod in self._module_dict.values(): mod.visit(visitor) visitor.visit_end() --=20 2.21.1