From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625954; cv=none; d=zoho.com; s=zohoarc; b=nCc1cmjWDOKLs0Y+60YEAAGjWXjJClqoz1SfUalxsUvCFRv4sQpIRipRJOdlDsrjAdM8/GsAn7OnbKbPlgtucDVADJwylEoGD/gCNFl8gU2GgbtDie9hz1ozFZte1GchIbYVd+ll2mKJe0PAif+bpTUKPMjf3YR+Cm9Ie4LLEVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625954; h=Content-Type:Content-Transfer-Encoding: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=8wLteWFN/PNygF3ZvP1kJ1vrZ7fKtWeOHqvANDYQ7qM=; b=XJio6kQkxKnPXezpi9fjJs3pgU4AKJAltGwxphIAwS1eJeOhAetWdL3g+7bHsWG4CsSAR7wMvXaHyRtMsPg04uV8qZOcgLmiblaXw+tSt9yI/W00yi9cxgX5VglCsrajICyJFoGJN7Nv+nOkVFw0QWSh+wDeaFW9pBeskJ732ng= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157062595417165.90882030868102; Wed, 9 Oct 2019 05:59:14 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 43A0A18CB912; Wed, 9 Oct 2019 12:59:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A2145C22F; Wed, 9 Oct 2019 12:59:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CE4D518037C9; Wed, 9 Oct 2019 12:59:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CwrD8002912 for ; Wed, 9 Oct 2019 08:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9FE485DA8D; Wed, 9 Oct 2019 12:58:53 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3716E5D9CD; Wed, 9 Oct 2019 12:58:51 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:35 +0100 Message-Id: <20191009125844.18202-2-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/10] docs: remove some dead code in apibuild.py X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Wed, 09 Oct 2019 12:59:12 +0000 (UTC) Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 92886e1276..3f0b72d18e 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -553,17 +553,10 @@ class CLexer: self.tokens.append(('name', line[s:i])) continue if line[i] in "(){}:;,[]": -# if line[i] =3D=3D '(' or line[i] =3D=3D ')' or line[i] = =3D=3D '{' or \ -# line[i] =3D=3D '}' or line[i] =3D=3D ':' or line[i] = =3D=3D ';' or \ -# line[i] =3D=3D ',' or line[i] =3D=3D '[' or line[i] = =3D=3D ']': self.tokens.append(('sep', line[i])) i =3D i + 1 continue if line[i] in "+-*><=3D/%&!|.": -# if line[i] =3D=3D '+' or line[i] =3D=3D '-' or line[i] = =3D=3D '*' or \ -# line[i] =3D=3D '>' or line[i] =3D=3D '<' or line[i] = =3D=3D '=3D' or \ -# line[i] =3D=3D '/' or line[i] =3D=3D '%' or line[i] = =3D=3D '&' or \ -# line[i] =3D=3D '!' or line[i] =3D=3D '|' or line[i] = =3D=3D '.': if line[i] =3D=3D '.' and i + 2 < l and \ line[i+1] =3D=3D '.' and line[i+2] =3D=3D '.': self.tokens.append(('name', '...')) @@ -572,10 +565,6 @@ class CLexer: =20 j =3D i + 1 if j < l and line[j] in "+-*><=3D/%&!|": -# line[j] =3D=3D '+' or line[j] =3D=3D '-' or line[j= ] =3D=3D '*' or \ -# line[j] =3D=3D '>' or line[j] =3D=3D '<' or line[j= ] =3D=3D '=3D' or \ -# line[j] =3D=3D '/' or line[j] =3D=3D '%' or line[j= ] =3D=3D '&' or \ -# line[j] =3D=3D '!' or line[j] =3D=3D '|'): self.tokens.append(('op', line[i:j+1])) i =3D j + 1 else: @@ -585,18 +574,6 @@ class CLexer: s =3D i while i < l: if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": -# line[i] !=3D ' ' and line[i] !=3D '\t' and -# line[i] !=3D '(' and line[i] !=3D ')' and -# line[i] !=3D '{' and line[i] !=3D '}' and -# line[i] !=3D ':' and line[i] !=3D ';' and -# line[i] !=3D ',' and line[i] !=3D '+' and -# line[i] !=3D '-' and line[i] !=3D '*' and -# line[i] !=3D '/' and line[i] !=3D '%' and -# line[i] !=3D '&' and line[i] !=3D '!' and -# line[i] !=3D '|' and line[i] !=3D '[' and -# line[i] !=3D ']' and line[i] !=3D '=3D' and -# line[i] !=3D '*' and line[i] !=3D '>' and -# line[i] !=3D '<'): i =3D i + 1 else: break --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625957; cv=none; d=zoho.com; s=zohoarc; b=hNpfVJDowFpQQTSlpfTGT01A2WxpiXNIrPvAYnNdKzB4j09YCNHXZ+xheFY0tU3xckdykt7zqV/6JQyhbomlD+j4Q6xVDw4p2YQKs4Y6lOC1XaBmOomMSM02Ddjb83nuCHh+YbDtuZ+HOnw9dL/REYEG4kUzITxNLmkGg8NQZOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625957; h=Content-Type:Content-Transfer-Encoding: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=NB20BBVX4mIGKDocvNYsOdwiOHZdvlP3APyCa7VfWz8=; b=iRQ7rv9SC1Y+ZqMMEVg3mFFAoKuA3hPARzlPyr96II9JI6rQaXZS5Cp3NOuTgFhTNAAE0w85hc3R4blBhvd4flYRbEbGOS7+WG6XbUnyJovmb4U1D+4t/Foqd1x2a7bEwXYqm4kvZasL/RnStWRBQ8hXlRQjfKnZ0FyJqS34a4Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625957996379.386476856077; Wed, 9 Oct 2019 05:59:17 -0700 (PDT) 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 1A628C05243E; Wed, 9 Oct 2019 12:59:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7F285D9CD; Wed, 9 Oct 2019 12:59:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 99C244EE6E; Wed, 9 Oct 2019 12:59:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CwvYA002930 for ; Wed, 9 Oct 2019 08:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 044A05DAAD; Wed, 9 Oct 2019 12:58:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74BDF5D9CD; Wed, 9 Oct 2019 12:58:53 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:36 +0100 Message-Id: <20191009125844.18202-3-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/10] build: change flake8 to use blacklist instead of whitelist X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@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.32]); Wed, 09 Oct 2019 12:59:16 +0000 (UTC) The current flake8 check only looks at one item (semicolons at end of line). This means that our code quality will continue to get worse, violating an increasing number of checks. Switching to a whitelist means that we freeze the badness at its current level & can incrementally fix things up. We are excluding the folllowing... Indentation: E114 indentation is not a multiple of four (comment) E115 expected an indented block (comment) E116 unexpected indentation (comment) E121 continuation line under-indented for hanging indent E125 continuation line with same indent as next logical line E126 continuation line over-indented for hanging indent E127 continuation line over-indented for visual indent E128 continuation line under-indented for visual indent E129 visually indented line with same indent as next logical line E131 continuation line unaligned for hanging indent Whitespace: E211 whitespace before =E2=80=98(=E2=80=98 E221 multiple spaces before operator E222 multiple spaces after operator E225 missing whitespace around operator E226 missing whitespace around arithmetic operator E231 missing whitespace after =E2=80=98,=E2=80=99, =E2=80=98;=E2=80=99, o= r =E2=80=98:=E2=80=99 E261 at least two spaces before inline comment Blank lines E301 expected 1 blank line, found 0 E302 expected 2 blank lines, found 0 E303 too many blank lines (3) E305 expected 2 blank lines after end of function or class Line length E501 line too long (82 > 79 characters) Statements E722 do not use bare except, specify exception instead E741 do not use variables named =E2=80=98l=E2=80=99, =E2=80=98O=E2=80=99,= or =E2=80=98I=E2=80=99 Errors: F821 undefined name 'name' Warnings: W504 line break after binary operator W605 invalid escape sequence =E2=80=98x=E2=80=99 Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 8345703b3e..1ad0c626e1 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -878,11 +878,28 @@ sc_require_enum_last_marker: { echo '$(ME): enum impl needs _LAST marker on second line' 1>&2; \ exit 1; } || : =20 -# In Python files we don't want to end lines with a semicolon like in C +# Validate many python style rules +FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E127,E128,E129,E131 +FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 +FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 +FLAKE8_LINE_LENGTH =3D E501 +FLAKE8_STATEMENTS =3D E722,E741 +FLAKE8_ERRORS =3D F821 +FLAKE8_WARNINGS =3D W504,W605 + +FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ + $(FLAKE8_WHITESPACE),$\ + $(FLAKE8_BLANK_LINES),$\ + $(FLAKE8_LINE_LENGTH),$\ + $(FLAKE8_STATEMENTS),$\ + $(FLAKE8_ERRORS),$\ + $(FLAKE8_WARNINGS) \ + $(NULL) + sc_flake8: @if [ -n "$(FLAKE8)" ]; then \ $(VC_LIST_EXCEPT) | $(GREP) '\.py$$' | xargs \ - $(FLAKE8) --select E703 --show-source; \ + $(FLAKE8) --ignore $(FLAKE8_IGNORE) --show-source; \ else \ echo '$(ME): skipping test $@: flake8 not installed' 1>&2; \ fi --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625944; cv=none; d=zoho.com; s=zohoarc; b=OOQrMxfpno1heqry4DY9WlUXHIrVe/2xNVNrYYb28u17YmEx6BTNEo1GC1oTNa9+mRt9eHDlascH27L4bZnWqztmfk7B/1fe+0wbe15iIsbIHHJXK0wcj0qPvPZ45d5luCgXgwJynsLFcCVAhVbdEg7R44wZWWLriaTR2JRnijU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625944; h=Content-Type:Content-Transfer-Encoding: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=qsFj7oQyWhYJ/tfru95KIMuCE0vf3VMmFDYlfLr5wuw=; b=TmvT9RciPZtSLPlhs4TSWn8PMtqGvhCnamHaeMHnaMKhnSZbjJocIY3iE5V4IY6587F6jTx9nwAKKZkiAtldyLg80HA0Lyt7xPrrPwzTk6U2L0/YfsITR1T7B6ESfZWFBklcXVjVaOhZ64fnXNWXTurnEE7Nn85+w710RCxqoVw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625944759488.5954781805925; Wed, 9 Oct 2019 05:59:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C811C08C320; Wed, 9 Oct 2019 12:59:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C69B60A9F; Wed, 9 Oct 2019 12:59:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CBA094EE68; Wed, 9 Oct 2019 12:59:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99Cx0KA002943 for ; Wed, 9 Oct 2019 08:59:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 305C15DA8D; Wed, 9 Oct 2019 12:59:00 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EAF35DC18; Wed, 9 Oct 2019 12:58:58 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:37 +0100 Message-Id: <20191009125844.18202-4-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/10] python: fix use of undeclared variables in python scripts X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 09 Oct 2019 12:59:03 +0000 (UTC) docs/apibuild.py:2436:65: F821 undefined name 'first_letter' chunks.append(["chunk%s" % (chunk - 1), first_lette= r, letter]) ^ src/hyperv/hyperv_wmi_generator.py:415:57: F821 undefined name 'number' report_error("line %d: invalid block header" % (number)) ^ Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 -- docs/apibuild.py | 1 + src/hyperv/hyperv_wmi_generator.py | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 1ad0c626e1..97255908b8 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -884,7 +884,6 @@ FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 FLAKE8_STATEMENTS =3D E722,E741 -FLAKE8_ERRORS =3D F821 FLAKE8_WARNINGS =3D W504,W605 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ @@ -892,7 +891,6 @@ FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ $(FLAKE8_BLANK_LINES),$\ $(FLAKE8_LINE_LENGTH),$\ $(FLAKE8_STATEMENTS),$\ - $(FLAKE8_ERRORS),$\ $(FLAKE8_WARNINGS) \ $(NULL) =20 diff --git a/docs/apibuild.py b/docs/apibuild.py index 3f0b72d18e..dc52caf76d 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -2401,6 +2401,7 @@ class docBuilder: count =3D 0 chunk =3D 0 chunks =3D [] + first_letter =3D None for id in typ: if len(index[id]) > 30: continue diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index a9ece0ff00..4f486913bd 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -407,7 +407,7 @@ def report_error(message): =20 =20 =20 -def parse_class(block): +def parse_class(block, number): # expected format: class header_items =3D block[0][1].split() =20 @@ -489,7 +489,7 @@ def main(): if block is not None: if line =3D=3D "end": if block[0][1].startswith("class"): - parse_class(block) + parse_class(block, number) =20 block =3D None else: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625955; cv=none; d=zoho.com; s=zohoarc; b=jqBIvJfUsO3oGghI7v7rlUbKH3zWJFNz6sm74xrlCSMKUgJSPMOgRJ1qSNgZnU3RKoA/VcgRpq1B02AWQXbgsPiDAM8EUPQculiOXOXh3LHqWF1t3U2/UE4jAFllyKZ4YfcPmKMUAXSqMJcA+iJNENfNcp4thKo0/C6+XaHR1ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625955; h=Content-Type:Content-Transfer-Encoding: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=DANpLhNd1sOYlyszguoHiZqR+BhrcypLIQInm8Lcix0=; b=TbyDaeG7RP5WH2GcsHwzIu4XFy1/6wBhR4bDm+5IEEIJHexvvcqlKfMDUuwjSZRGx6wiR6SR5X0qAfwTVS5hKpcc3rNV9ZV3Rd2TWeH6Al/Aw1M7ldqcD1jDKQH144mjFZW0805Ckg3jWT5PYD1d04Y24Tp4YBkdXhQxqbpCIaE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625955266814.4516221982037; Wed, 9 Oct 2019 05:59:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68F7510576D7; Wed, 9 Oct 2019 12:59:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4575A60BF4; Wed, 9 Oct 2019 12:59:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 05F064EE6D; Wed, 9 Oct 2019 12:59:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99Cx2A6002952 for ; Wed, 9 Oct 2019 08:59:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F57C5D9D6; Wed, 9 Oct 2019 12:59:02 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AEF45D9CD; Wed, 9 Oct 2019 12:59:00 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:38 +0100 Message-Id: <20191009125844.18202-5-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] python: mark regex strings with 'r' prefix X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 09 Oct 2019 12:59:13 +0000 (UTC) When writing regexes special regex matches like "\d" can get misinterpreted as normal string escape sequences: docs/apibuild.py:1359:51: W605 invalid escape sequence '\d' value =3D value + re.sub("^(\d+)U$", "\\1", token[1= ]) ^ docs/apibuild.py:2134:31: W605 invalid escape sequence '\(' m =3D re.match("\(?1<<(\d+)\)?", info[0]) ^ docs/apibuild.py:2134:38: W605 invalid escape sequence '\d' m =3D re.match("\(?1<<(\d+)\)?", info[0]) ^ docs/apibuild.py:2134:42: W605 invalid escape sequence '\)' m =3D re.match("\(?1<<(\d+)\)?", info[0]) ^ To avoid this probem all regexes should use the r"...." syntax for their strings, which disables normal string escape sequences. Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 +- docs/apibuild.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 97255908b8..acd3f96c6d 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -884,7 +884,7 @@ FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 FLAKE8_STATEMENTS =3D E722,E741 -FLAKE8_WARNINGS =3D W504,W605 +FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ $(FLAKE8_WHITESPACE),$\ diff --git a/docs/apibuild.py b/docs/apibuild.py index dc52caf76d..18dc3604d0 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -665,7 +665,7 @@ class CParser: for line in lines: line =3D line.lstrip().lstrip('*').lstrip() =20 - m =3D re.match('([_.a-zA-Z0-9]+):(.*)', line) + m =3D re.match(r'([_.a-zA-Z0-9]+):(.*)', line) if m: item =3D m.group(1) line =3D m.group(2).lstrip() @@ -1333,7 +1333,7 @@ class CParser: while token[0] !=3D "sep" or (token[1] !=3D ',' and token[1] !=3D '}'): # We might be dealing with '1U << 12' here - value =3D value + re.sub("^(\d+)U$", "\\1", token[= 1]) + value =3D value + re.sub(r"^(\d+)U$", "\\1", token= [1]) token =3D self.token() else: try: @@ -2108,7 +2108,7 @@ class docBuilder: if valhex !=3D "": output.write(" value_hex=3D'%s'" % (valhex)) =20 - m =3D re.match("\(?1<<(\d+)\)?", info[0]) + m =3D re.match(r"\(?1<<(\d+)\)?", info[0]) if m: output.write(" value_bitshift=3D'%s'" % (m.group(1))) =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625958; cv=none; d=zoho.com; s=zohoarc; b=W/rzETpiAzA6qKRIsIdVLDGIWBxBNJgF4GQuD6ZWHLJ/JrQPcPqKC7KxYgvOIHYa5u0CBGjJTqja02/F96Y2ZxohY7LzfqdmyodJOBMPY6bxf+iiUMlV6FyCJVI9eItKg+5rjayAZlJX8PylqT6ifvfK6bsN0UqFVDKrPShsUtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625958; h=Content-Type:Content-Transfer-Encoding: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=7GJR5zSk7/MHwWb/VObkrACc+vOrG//08kty8WIV44o=; b=afHPrcaBMzdYAgqCcwToXQl41sXUAlm7V9MscJTFPGlUwGRG5qcn4shf63Q8biR9DlUspR35pZyysoJqnw04VM9J5jt9h/hGhE34VxKriZA7IaY+goFM/1Ng2HAviWJiAeaZT1rccCO+L/PiBSMxk21Oy6KXRnxypyRBARXt8ws= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15706259587901003.3842262810994; Wed, 9 Oct 2019 05:59:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B12F88384B; Wed, 9 Oct 2019 12:59:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11D751001B07; Wed, 9 Oct 2019 12:59:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C6CA118037C9; Wed, 9 Oct 2019 12:59:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99Cx3jB002961 for ; Wed, 9 Oct 2019 08:59:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD4675D9D6; Wed, 9 Oct 2019 12:59:03 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBC986762F; Wed, 9 Oct 2019 12:59:02 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:39 +0100 Message-Id: <20191009125844.18202-6-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] python: avoid variable named 'l' X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Wed, 09 Oct 2019 12:59:17 +0000 (UTC) Python code style recommends avoiding a variable named 'l' as it is visually similar to '1'. docs/apibuild.py:482:13: E741 ambiguous variable name 'l' l =3D len(line) ^ docs/apibuild.py:503:21: E741 ambiguous variable name 'l' l =3D len(line) ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 +- docs/apibuild.py | 100 +++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index acd3f96c6d..b138220b30 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -883,7 +883,7 @@ FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E1= 27,E128,E129,E131 FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 -FLAKE8_STATEMENTS =3D E722,E741 +FLAKE8_STATEMENTS =3D E722 FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ diff --git a/docs/apibuild.py b/docs/apibuild.py index 18dc3604d0..b3ef462565 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -479,7 +479,7 @@ class CLexer: self.tokens[0] =3D ('preproc', "#" + self.tokens[1][1]) del self.tokens[1] break - l =3D len(line) + nline =3D len(line) if line[0] =3D=3D '"' or line[0] =3D=3D "'": quote =3D line[0] i =3D 1 @@ -500,12 +500,12 @@ class CLexer: tok =3D "" while found =3D=3D 0: i =3D 0 - l =3D len(line) - while i < l: - if line[i] =3D=3D '*' and i+1 < l and line[i+1] = =3D=3D '/': + nline =3D len(line) + while i < nline: + if line[i] =3D=3D '*' and i+1 < nline and line[i+1= ] =3D=3D '/': self.line =3D line[i+2:] line =3D line[:i-1] - l =3D i + nline =3D i found =3D 1 break i =3D i + 1 @@ -523,12 +523,12 @@ class CLexer: self.last =3D ('comment', line) return self.last i =3D 0 - while i < l: - if line[i] =3D=3D '/' and i+1 < l and line[i+1] =3D=3D '/': + while i < nline: + if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '/': self.line =3D line[i:] line =3D line[:i] break - if line[i] =3D=3D '/' and i+1 < l and line[i+1] =3D=3D '*': + if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '*': self.line =3D line[i:] line =3D line[:i] break @@ -537,15 +537,15 @@ class CLexer: line =3D line[:i] break i =3D i + 1 - l =3D len(line) + nline =3D len(line) i =3D 0 - while i < l: + while i < nline: if line[i] =3D=3D ' ' or line[i] =3D=3D '\t': i =3D i + 1 continue if line[i].isalnum(): s =3D i - while i < l: + while i < nline: if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": i =3D i + 1 else: @@ -557,14 +557,14 @@ class CLexer: i =3D i + 1 continue if line[i] in "+-*><=3D/%&!|.": - if line[i] =3D=3D '.' and i + 2 < l and \ + if line[i] =3D=3D '.' and i + 2 < nline and \ line[i+1] =3D=3D '.' and line[i+2] =3D=3D '.': self.tokens.append(('name', '...')) i =3D i + 3 continue =20 j =3D i + 1 - if j < l and line[j] in "+-*><=3D/%&!|": + if j < nline and line[j] in "+-*><=3D/%&!|": self.tokens.append(('op', line[i:j+1])) i =3D j + 1 else: @@ -572,7 +572,7 @@ class CLexer: i =3D i + 1 continue s =3D i - while i < l: + while i < nline: if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": i =3D i + 1 else: @@ -779,9 +779,9 @@ class CParser: while lines[0] =3D=3D '*': del lines[0] while len(lines) > 0 and lines[0][0:3] =3D=3D '* @': - l =3D lines[0][3:] + prefix =3D lines[0][3:] try: - arg, desc =3D l.split(':', 1) + arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() except: @@ -791,25 +791,25 @@ class CParser: del lines[0] continue del lines[0] - l =3D lines[0].strip() - while len(l) > 2 and l[0:3] !=3D '* @': - while l[0] =3D=3D '*': - l =3D l[1:] - desc =3D desc + ' ' + l.strip() + line =3D lines[0].strip() + while len(line) > 2 and line[0:3] !=3D '* @': + while line[0] =3D=3D '*': + line =3D line[1:] + desc =3D desc + ' ' + line.strip() del lines[0] if len(lines) =3D=3D 0: break - l =3D lines[0] + line =3D lines[0] args.append((arg, desc)) while len(lines) > 0 and lines[0] =3D=3D '*': del lines[0] desc =3D "" while len(lines) > 0: - l =3D lines[0] - while len(l) > 0 and l[0] =3D=3D '*': - l =3D l[1:] - l =3D l.strip() - desc =3D desc + " " + l + line =3D lines[0] + while len(line) > 0 and line[0] =3D=3D '*': + line =3D line[1:] + line =3D line.strip() + desc =3D desc + " " + line del lines[0] =20 desc =3D desc.strip() @@ -860,9 +860,9 @@ class CParser: del lines[0] nbargs =3D len(args) while len(lines) > 0 and lines[0][0:3] =3D=3D '* @': - l =3D lines[0][3:] + prefix =3D lines[0][3:] try: - arg, desc =3D l.split(':', 1) + arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() except: @@ -872,15 +872,15 @@ class CParser: del lines[0] continue del lines[0] - l =3D lines[0].strip() - while len(l) > 2 and l[0:3] !=3D '* @': - while l[0] =3D=3D '*': - l =3D l[1:] - desc =3D desc + ' ' + l.strip() + line =3D lines[0].strip() + while len(line) > 2 and line[0:3] !=3D '* @': + while line[0] =3D=3D '*': + line =3D line[1:] + desc =3D desc + ' ' + line.strip() del lines[0] if len(lines) =3D=3D 0: break - l =3D lines[0] + line =3D lines[0] i =3D 0 while i < nbargs: if args[i][1] =3D=3D arg: @@ -895,35 +895,35 @@ class CParser: del lines[0] desc =3D None while len(lines) > 0: - l =3D lines[0] + line =3D lines[0] i =3D 0 # Remove all leading '*', followed by at most one ' ' character # since we need to preserve correct indentation of code exampl= es - while i < len(l) and l[i] =3D=3D '*': + while i < len(line) and line[i] =3D=3D '*': i =3D i + 1 if i > 0: - if i < len(l) and l[i] =3D=3D ' ': + if i < len(line) and line[i] =3D=3D ' ': i =3D i + 1 - l =3D l[i:] - if len(l) >=3D 6 and l[0:7] =3D=3D "Returns": + line =3D line[i:] + if len(line) >=3D 6 and line[0:7] =3D=3D "Returns": try: - l =3D l.split(' ', 1)[1] + line =3D line.split(' ', 1)[1] except: - l =3D "" - retdesc =3D l.strip() + line =3D "" + retdesc =3D line.strip() del lines[0] while len(lines) > 0: - l =3D lines[0] - while len(l) > 0 and l[0] =3D=3D '*': - l =3D l[1:] - l =3D l.strip() - retdesc =3D retdesc + " " + l + line =3D lines[0] + while len(line) > 0 and line[0] =3D=3D '*': + line =3D line[1:] + line =3D line.strip() + retdesc =3D retdesc + " " + line del lines[0] else: if desc is not None: - desc =3D desc + "\n" + l + desc =3D desc + "\n" + line else: - desc =3D l + desc =3D line del lines[0] =20 if desc is None: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625962; cv=none; d=zoho.com; s=zohoarc; b=bitOsh+X/73Fee6t+Fg9kHwZeWSzO9l2pBsc9ipV7iFzQuzL5lHO9xP8SfBBg3TSWIPuP7sOMjjxuzyonPJiJrStmyNlARjpQg9xHJozgPYK2PMBPJGxae49dvtbLG9W8oDofDYOxvjvxXIwYe9mk91qo4nomod5HYrjyxNr6fo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625962; h=Content-Type:Content-Transfer-Encoding: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=1xjYVjwSNGLQB6zYsQqCMOoSAo/oQCHWJ7ROdXfS5Bs=; b=F6gorEoscDQXBR2ZU8L5KNANdHM9LQwEnxtNweR9egY8zkzg7Ylt5e2kL9RemvcKFQs+qURL6EZtGcTvIM0lZgfsjGNydbwOOmhQDpUC+aXzD/V9JH57N3o9jwpcJjwHD8coX+3aVJPP2aMc3gxgZy8EKsa7MeYEzmRcDVvXY7A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625962714287.19629313132384; Wed, 9 Oct 2019 05:59:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDAB811A23; Wed, 9 Oct 2019 12:59:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A66086061E; Wed, 9 Oct 2019 12:59:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5EEDE18037C9; Wed, 9 Oct 2019 12:59:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CxAqW002979 for ; Wed, 9 Oct 2019 08:59:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 699A15DA8C; Wed, 9 Oct 2019 12:59:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDF7C5DAAD; Wed, 9 Oct 2019 12:59:04 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:40 +0100 Message-Id: <20191009125844.18202-7-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/10] python: avoid bare 'except:' clause X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 09 Oct 2019 12:59:21 +0000 (UTC) Exception catching statements should always match on a class name, the most specific one possible. Rather than analyse the code to look at what the most specific one is, this just uses the base Exception class. docs/apibuild.py:255:9: E722 do not use bare 'except' except: ^ docs/apibuild.py:279:9: E722 do not use bare 'except' except: ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 -- docs/apibuild.py | 38 +++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index b138220b30..c66183c1b0 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -883,14 +883,12 @@ FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,= E127,E128,E129,E131 FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 -FLAKE8_STATEMENTS =3D E722 FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ $(FLAKE8_WHITESPACE),$\ $(FLAKE8_BLANK_LINES),$\ $(FLAKE8_LINE_LENGTH),$\ - $(FLAKE8_STATEMENTS),$\ $(FLAKE8_WARNINGS) \ $(NULL) =20 diff --git a/docs/apibuild.py b/docs/apibuild.py index b3ef462565..86163c20b1 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -252,7 +252,7 @@ class index: try: d =3D self.identifiers[name] d.update(header, module, type, lineno, info, extra, conditiona= ls) - except: + except Exception: d =3D identifier(name, header, module, type, lineno, info, ext= ra, conditionals) self.identifiers[name] =3D d @@ -276,7 +276,7 @@ class index: try: d =3D self.identifiers[name] d.update(header, module, type, lineno, info, extra, conditiona= ls) - except: + except Exception: d =3D identifier(name, header, module, type, lineno, info, ext= ra, conditionals) self.identifiers[name] =3D d @@ -784,7 +784,7 @@ class CParser: arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() - except: + except Exception: if not quiet: self.warning("Misformatted macro comment for %s" % nam= e) self.warning(" problem with '%s'" % lines[0]) @@ -865,7 +865,7 @@ class CParser: arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() - except: + except Exception: if not quiet: self.warning("Misformatted function comment for %s" % = name) self.warning(" problem with '%s'" % lines[0]) @@ -908,7 +908,7 @@ class CParser: if len(line) >=3D 6 and line[0:7] =3D=3D "Returns": try: line =3D line.split(' ', 1)[1] - except: + except Exception: line =3D "" retdesc =3D line.strip() del lines[0] @@ -976,7 +976,7 @@ class CParser: token =3D self.lexer.token() try: name =3D name.split('(') [0] - except: + except Exception: pass =20 # skip hidden macros @@ -1016,7 +1016,7 @@ class CParser: self.defines.append(apstr) if apstr.find('ENABLED') !=3D -1: self.conditionals.append("defined(%s)" % apstr) - except: + except Exception: pass elif name =3D=3D "#ifndef": apstr =3D self.lexer.tokens[0][1] @@ -1024,7 +1024,7 @@ class CParser: self.defines.append(apstr) if apstr.find('ENABLED') !=3D -1: self.conditionals.append("!defined(%s)" % apstr) - except: + except Exception: pass elif name =3D=3D "#if": apstr =3D "" @@ -1036,7 +1036,7 @@ class CParser: self.defines.append(apstr) if apstr.find('ENABLED') !=3D -1: self.conditionals.append(apstr) - except: + except Exception: pass elif name =3D=3D "#else": if self.conditionals !=3D [] and \ @@ -1338,7 +1338,7 @@ class CParser: else: try: value =3D "%d" % (int(value) + 1) - except: + except Exception: self.warning("Failed to compute value of enum %s" = % name) value =3D "" if token[0] =3D=3D "sep" and token[1] =3D=3D ",": @@ -1797,7 +1797,7 @@ class CParser: try: if not CParser.long_legacy_functions[name][0]: raise Exception() - except: + except Exception: self.error(("function '%s' is not allowed to return long, " "use long long instead") % name) =20 @@ -1806,7 +1806,7 @@ class CParser: try: if param[1] not in CParser.long_legacy_functions[name]= [1]: raise Exception() - except: + except Exception: self.error(("function '%s' is not allowed to take long= " "parameter '%s', use long long instead") % (name, param[1])) @@ -1826,7 +1826,7 @@ class CParser: try: if field[1] not in CParser.long_legacy_struct_fields[n= ame]: raise Exception() - except: + except Exception: self.error(("struct '%s' is not allowed to contain lon= g " "field '%s', use long long instead") % (name, field[1])) @@ -2101,7 +2101,7 @@ class docBuilder: try: val =3D eval(info[0]) valhex =3D hex(val) - except: + except Exception: val =3D info[0] output.write(" value=3D'%s'" % (val)) =20 @@ -2181,7 +2181,7 @@ class docBuilder: self.serialize_union(output, field, desc) else: output.write(" \n" % (field[1], field[0], desc)) - except: + except Exception: self.warning("Failed to serialize struct %s" % name) output.write(" \n") else: @@ -2196,7 +2196,7 @@ class docBuilder: output.write(" \n") else: output.write("/>\n") - except: + except Exception: output.write("/>\n") =20 def serialize_variable(self, output, name): @@ -2251,7 +2251,7 @@ class docBuilder: else: output.write(" \n" % (param[1], param[0], escape(param[2]))) self.indexString(name, param[2]) - except: + except Exception: print("Exception:", sys.exc_info()[1], file=3Dsys.stderr) self.warning("Failed to save function %s info: %s" % (name, re= pr(id.info))) output.write(" \n" % (id.type)) @@ -2331,7 +2331,7 @@ class docBuilder: funcs[param[0]].append(name) else: funcs[param[0]] =3D [name] - except: + except Exception: pass typ =3D sorted(funcs.keys()) for type in typ: @@ -2359,7 +2359,7 @@ class docBuilder: funcs[ret[0]].append(name) else: funcs[ret[0]] =3D [name] - except: + except Exception: pass typ =3D sorted(funcs.keys()) for type in typ: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625966; cv=none; d=zoho.com; s=zohoarc; b=NSaeOYjZZ+BeqtuvoKZtGhTbkUYslrrGTJj4ektk/hS4xXORjBUK8WuuaNL/GMblnuH0yNWyE/cWFDj+j6qdwYtLaTkO811A3cYS01GC5XTBdLvzp+tS2zr3q2iLsaLctMHEaaaDgC2AT9EqwHyyfifLpOSNix8FQotqRmpznnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625966; h=Content-Type:Content-Transfer-Encoding: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=Bkm6K9cRYcl7YTQ0/VsyuW/48y8OiTrQoucfJtYQURQ=; b=THcBxRdxCisKlfGLVW0X5jf/Cy2twClyOIzSr03eGmfdWfd0WWMgIib4nKmkLvI9FB5LEbuSUmi+vfsrqBhwjvoTXFmqUTDT3SWnVDnnQK47P+LY1trKqa8+MosNR7wo6OI1Y82TfRGeKAiCfUdcmJgAfgL9BJILG5y7XUBRqDg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625966573730.6140682426845; Wed, 9 Oct 2019 05:59:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 809952CE90A; Wed, 9 Oct 2019 12:59:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58383165F9; Wed, 9 Oct 2019 12:59:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1193B4EE6A; Wed, 9 Oct 2019 12:59:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CxG15003012 for ; Wed, 9 Oct 2019 08:59:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id D15D55DAAD; Wed, 9 Oct 2019 12:59:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E14525DA2C; Wed, 9 Oct 2019 12:59:10 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:41 +0100 Message-Id: <20191009125844.18202-8-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/10] python: sanitize blank line usage X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 09 Oct 2019 12:59:25 +0000 (UTC) Coding style expects 1 blank line between each method and 2 blank lines before each class. docs/apibuild.py:171:5: E303 too many blank lines (2) def set_header(self, header): ^ docs/apibuild.py:230:1: E302 expected 2 blank lines, found 1 class index: ^ docs/apibuild.py:175:5: E301 expected 1 blank line, found 0 def set_module(self, module): ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 - docs/apibuild.py | 26 ++++++++-- docs/reformat-news.py | 1 + src/esx/esx_vi_generator.py | 81 ------------------------------ src/hyperv/hyperv_wmi_generator.py | 23 +-------- tests/cputestdata/cpu-cpuid.py | 1 + 6 files changed, 25 insertions(+), 109 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index c66183c1b0..c6d7ad1b9d 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -881,13 +881,11 @@ sc_require_enum_last_marker: # Validate many python style rules FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E127,E128,E129,E131 FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 -FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ $(FLAKE8_WHITESPACE),$\ - $(FLAKE8_BLANK_LINES),$\ $(FLAKE8_LINE_LENGTH),$\ $(FLAKE8_WARNINGS) \ $(NULL) diff --git a/docs/apibuild.py b/docs/apibuild.py index 86163c20b1..e944c01321 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -123,6 +123,7 @@ hidden_macros =3D { "VIR_EXPORT_VAR": "internal macro to mark exported vars", } =20 + def escape(raw): raw =3D raw.replace('&', '&') raw =3D raw.replace('<', '<') @@ -131,9 +132,11 @@ def escape(raw): raw =3D raw.replace('"', '"') return raw =20 + def uniq(items): return sorted(set(items)) =20 + class identifier: def __init__(self, name, header=3DNone, module=3DNone, type=3DNone, li= neno=3D0, info=3DNone, extra=3DNone, conditionals=3DNone): @@ -167,21 +170,27 @@ class identifier: r =3D r + " " + repr(self.conditionals) return r =20 - def set_header(self, header): self.header =3D header + def set_module(self, module): self.module =3D module + def set_type(self, type): self.type =3D type + def set_info(self, info): self.info =3D info + def set_extra(self, extra): self.extra =3D extra + def set_lineno(self, lineno): self.lineno =3D lineno + def set_static(self, static): self.static =3D static + def set_conditionals(self, conditionals): if conditionals is None or len(conditionals) =3D=3D 0: self.conditionals =3D None @@ -190,20 +199,28 @@ class identifier: =20 def get_name(self): return self.name + def get_header(self): return self.module + def get_module(self): return self.module + def get_type(self): return self.type + def get_info(self): return self.info + def get_lineno(self): return self.lineno + def get_extra(self): return self.extra + def get_static(self): return self.static + def get_conditionals(self): return self.conditionals =20 @@ -225,6 +242,7 @@ class identifier: if conditionals is not None: self.set_conditionals(conditionals) =20 + class index: def __init__(self, name=3D"noname"): self.name =3D name @@ -409,7 +427,6 @@ class index: elif count !=3D 0: print(" %d public %s" % (count, type)) =20 - def analyze(self): if not quiet: self.analyze_dict("functions", self.functions) @@ -419,6 +436,7 @@ class index: self.analyze_dict("typedefs", self.typedefs) self.analyze_dict("macros", self.macros) =20 + class CLexer: """A lexer for the C language, tokenize the input by reading and analyzing it line by line""" @@ -584,6 +602,7 @@ class CLexer: self.last =3D tok return tok =20 + class CParser: """The C module parser""" def __init__(self, filename, idx=3DNone): @@ -745,6 +764,7 @@ class CParser: % name) =20 return desc + # # Parse a comment block associate to a macro # @@ -945,7 +965,6 @@ class CParser: if desc =3D=3D "": self.warning("Function comment for %s lacks description of= the function" % name) =20 - return (ret[0], retdesc), args, desc =20 def parsePreproc(self, token): @@ -1434,7 +1453,6 @@ class CParser: if token[0] =3D=3D "comment": token =3D self.token() =20 - if token[0] =3D=3D "sep" and token[1] =3D=3D ';': token =3D self.token() =20 diff --git a/docs/reformat-news.py b/docs/reformat-news.py index 955ce2d45b..a06f945c02 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -24,6 +24,7 @@ import sys =20 COLUMNS =3D 80 =20 + def reformat_with_indent(text, initial_indent, indent): =20 res =3D "" diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 28d440a6df..2310b56ad0 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -29,7 +29,6 @@ import os import os.path =20 =20 - OCCURRENCE__REQUIRED_ITEM =3D "r" OCCURRENCE__REQUIRED_LIST =3D "rl" OCCURRENCE__OPTIONAL_ITEM =3D "o" @@ -47,30 +46,24 @@ autobind_names =3D set() separator =3D "/* " + ("* " * 37) + "*\n" =20 =20 - def aligned(left, right, length=3D59): return left.ljust(length, ' ') + right =20 =20 - class Member: def __init__(self, type, occurrence): self.type =3D type self.occurrence =3D occurrence =20 - def is_enum(self): return self.type in predefined_enums or self.type in enums_by_name =20 - def is_object(self): return self.type in predefined_objects or self.type in objects_by_= name =20 - def is_type_generated(self): return self.type in enums_by_name or self.type in objects_by_name =20 - def get_occurrence_comment(self): occurrence_map =3D { OCCURRENCE__REQUIRED_ITEM: "/* required */", @@ -84,8 +77,6 @@ class Member: raise ValueError("unknown occurrence value '%s'" % self.occurr= ence) =20 =20 - - class Parameter(Member): def __init__(self, type, name, occurrence): Member.__init__(self, type, occurrence) @@ -96,7 +87,6 @@ class Parameter(Member): self.name =3D name self.autobind_name =3D None =20 - def generate_parameter(self, is_last=3DFalse, is_header=3DTrue, offset= =3D0): if self.occurrence =3D=3D OCCURRENCE__IGNORED: raise ValueError("invalid function parameter occurrence value = '%s'" @@ -118,7 +108,6 @@ class Parameter(Member): =20 return aligned(string, self.get_occurrence_comment() + "\n") =20 - def generate_return(self, offset=3D0, end_of_line=3D";"): if self.occurrence =3D=3D OCCURRENCE__IGNORED: raise ValueError("invalid function parameter occurrence value = '%s'" @@ -131,7 +120,6 @@ class Parameter(Member): =20 return aligned(string, self.get_occurrence_comment() + "\n") =20 - def generate_require_code(self): if self.occurrence in [OCCURRENCE__REQUIRED_ITEM, OCCURRENCE__REQUIRED_LIST]: @@ -139,7 +127,6 @@ class Parameter(Member): else: return "" =20 - def generate_serialize_code(self): if self.occurrence in [OCCURRENCE__REQUIRED_LIST, OCCURRENCE__OPTIONAL_LIST]: @@ -152,7 +139,6 @@ class Parameter(Member): return " ESX_VI__METHOD__PARAMETER__SERIALIZE(%s, %s)\n" \ % (self.type, self.name) =20 - def get_type_string(self, as_return_value=3DFalse): string =3D "" =20 @@ -173,7 +159,6 @@ class Parameter(Member): =20 return string =20 - def get_occurrence_short_enum(self): if self.occurrence =3D=3D OCCURRENCE__REQUIRED_ITEM: return "RequiredItem" @@ -187,7 +172,6 @@ class Parameter(Member): raise ValueError("unknown occurrence value '%s'" % self.occurrence) =20 =20 - class Method: def __init__(self, name, parameters, returns): self.name =3D name @@ -201,7 +185,6 @@ class Method: else: self.autobind_parameter =3D parameter =20 - def generate_header(self): header =3D "int esxVI_%s\n" % self.name header +=3D " (esxVI_Context *ctx" @@ -224,7 +207,6 @@ class Method: =20 return header =20 - def generate_source(self): source =3D "/* esxVI_%s */\n" % self.name source +=3D "ESX_VI__METHOD(%s," % self.name @@ -288,14 +270,12 @@ class Method: return source =20 =20 - class Property(Member): def __init__(self, type, name, occurrence): Member.__init__(self, type, occurrence) =20 self.name =3D name =20 - def generate_struct_member(self): if self.occurrence =3D=3D OCCURRENCE__IGNORED: return " /* FIXME: %s is currently ignored */\n" % self.name @@ -304,7 +284,6 @@ class Property(Member): =20 return aligned(string, self.get_occurrence_comment() + "\n") =20 - def generate_free_code(self): if self.type =3D=3D "String" and \ self.occurrence not in [OCCURRENCE__REQUIRED_LIST, @@ -319,7 +298,6 @@ class Property(Member): else: return " esxVI_%s_Free(&item->%s);\n" % (self.type, sel= f.name) =20 - def generate_validate_code(self, managed=3DFalse): if managed: macro =3D "ESX_VI__TEMPLATE__PROPERTY__MANAGED_REQUIRE" @@ -334,7 +312,6 @@ class Property(Member): else: return "" =20 - def generate_deep_copy_code(self): if self.occurrence =3D=3D OCCURRENCE__IGNORED: return " /* FIXME: %s is currently ignored */\n" % self.name @@ -351,7 +328,6 @@ class Property(Member): return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(%s, %s)\n" \ % (self.type, self.name) =20 - def generate_serialize_code(self): if self.occurrence =3D=3D OCCURRENCE__IGNORED: return " /* FIXME: %s is currently ignored */\n" % self.name @@ -366,7 +342,6 @@ class Property(Member): return " ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(%s, %s)\n" \ % (self.type, self.name) =20 - def generate_deserialize_code(self): if self.occurrence =3D=3D OCCURRENCE__IGNORED: return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(%s)= /* FIXME */\n" \ @@ -382,7 +357,6 @@ class Property(Member): return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(%s, %s)\n"= \ % (self.type, self.name) =20 - def generate_lookup_code(self): if self.occurrence =3D=3D OCCURRENCE__IGNORED: return " ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE_IGN= ORE(%s) /* FIXME */\n" \ @@ -398,7 +372,6 @@ class Property(Member): return " ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE(%s,= %s)\n" \ % (self.type, self.name) =20 - def get_type_string(self): if self.type =3D=3D "String" and \ self.occurrence not in [OCCURRENCE__REQUIRED_LIST, @@ -410,29 +383,24 @@ class Property(Member): return "esxVI_%s *" % self.type =20 =20 - class Type: def __init__(self, kind, name): self.kind =3D kind self.name =3D name =20 - def generate_typedef(self): return "typedef %s _esxVI_%s esxVI_%s;\n" \ % (self.kind, self.name, self.name) =20 - def generate_typeenum(self): return " esxVI_Type_%s,\n" % self.name =20 - def generate_typetostring(self): string =3D " case esxVI_Type_%s:\n" % self.name string +=3D " return \"%s\";\n\n" % self.name =20 return string =20 - def generate_typefromstring(self): string =3D " if (STREQ(type, \"%s\"))\n" % self.name string +=3D " return esxVI_Type_%s;\n" % self.name @@ -448,14 +416,12 @@ class GenericObject(Type): FEATURE__SERIALIZE =3D (1 << 5) FEATURE__DESERIALIZE =3D (1 << 6) =20 - def __init__(self, name, category, managed, generic_objects_by_name): Type.__init__(self, "struct", name) self.category =3D category self.managed =3D managed self.generic_objects_by_name =3D generic_objects_by_name =20 - def generate_comment(self): comment =3D separator comment +=3D " * %s: %s\n" % (self.category, self.name) @@ -480,7 +446,6 @@ class GenericObject(Type): =20 return comment =20 - def generate_struct_members(self, add_banner=3DFalse, struct_gap=3DFal= se): members =3D "" =20 @@ -503,7 +468,6 @@ class GenericObject(Type): =20 return members =20 - def generate_dispatch(self, suffix, is_first=3DTrue): source =3D "" =20 @@ -523,7 +487,6 @@ class GenericObject(Type): =20 return source =20 - def generate_free_code(self, add_banner=3DFalse): source =3D "" =20 @@ -549,7 +512,6 @@ class GenericObject(Type): =20 return source =20 - def generate_validate_code(self, add_banner=3DFalse): source =3D "" =20 @@ -576,7 +538,6 @@ class GenericObject(Type): return source =20 =20 - class Object(GenericObject): def __init__(self, name, extends, properties, features=3D0, extended_b= y=3DNone): GenericObject.__init__(self, name, 'VI Object', False, objects_by_= name) @@ -589,7 +550,6 @@ class Object(GenericObject): if self.extended_by is not None: self.extended_by.sort() =20 - def generate_dynamic_cast_code(self, is_first=3DTrue): source =3D "" =20 @@ -609,7 +569,6 @@ class Object(GenericObject): =20 return source =20 - def generate_deep_copy_code(self, add_banner=3DFalse): source =3D "" =20 @@ -635,7 +594,6 @@ class Object(GenericObject): =20 return source =20 - def generate_serialize_code(self, add_banner=3DFalse): source =3D "" =20 @@ -654,7 +612,6 @@ class Object(GenericObject): =20 return source =20 - def generate_deserialize_code(self, add_banner=3DFalse): source =3D "" =20 @@ -673,7 +630,6 @@ class Object(GenericObject): =20 return source =20 - def generate_header(self): header =3D self.generate_comment() =20 @@ -754,7 +710,6 @@ class Object(GenericObject): =20 return header =20 - def generate_source(self): source =3D separator source +=3D " * VI Object: %s\n" % self.name @@ -916,7 +871,6 @@ class Object(GenericObject): return source =20 =20 - class ManagedObject(GenericObject): def __init__(self, name, extends, properties, features=3D0, extended_b= y=3DNone): GenericObject.__init__(self, name, 'VI Managed Object', True, @@ -929,7 +883,6 @@ class ManagedObject(GenericObject): if self.extended_by is not None: self.extended_by.sort() =20 - def generate_lookup_code1(self, add_banner=3DFalse): source =3D "" =20 @@ -955,7 +908,6 @@ class ManagedObject(GenericObject): =20 return source =20 - def generate_lookup_code2(self, add_banner=3DFalse): source =3D "" =20 @@ -981,7 +933,6 @@ class ManagedObject(GenericObject): =20 return source =20 - def generate_header(self): header =3D self.generate_comment() =20 @@ -1017,7 +968,6 @@ class ManagedObject(GenericObject): =20 return header =20 - def generate_helper_header(self): # functions return ( @@ -1030,7 +980,6 @@ class ManagedObject(GenericObject): % {"name": self.name} ) =20 - def generate_source(self): source =3D self.generate_comment() =20 @@ -1084,7 +1033,6 @@ class ManagedObject(GenericObject): =20 return source =20 - def generate_helper_source(self): # lookup return ( @@ -1106,13 +1054,11 @@ class Enum(Type): FEATURE__SERIALIZE =3D (1 << 2) FEATURE__DESERIALIZE =3D (1 << 3) =20 - def __init__(self, name, values, features=3D0): Type.__init__(self, "enum", name) self.values =3D values self.features =3D features =20 - def generate_header(self): header =3D separator header +=3D " * VI Enum: %s\n" % self.name @@ -1145,7 +1091,6 @@ class Enum(Type): =20 return header =20 - def generate_source(self): source =3D separator source +=3D " * VI Enum: %s\n" % self.name @@ -1183,18 +1128,15 @@ class Enum(Type): return source =20 =20 - def report_error(message): print("error: " + message) sys.exit(1) =20 =20 - def capitalize_first(string): return string[:1].upper() + string[1:] =20 =20 - def parse_object(block): # expected format: [managed] object [extends ] header_items =3D block[0][1].split() @@ -1239,7 +1181,6 @@ def parse_object(block): return Object(name=3Dname, extends=3Dextends, properties=3Dpropert= ies) =20 =20 - def parse_enum(block): # expected format: enum header_items =3D block[0][1].split() @@ -1260,7 +1201,6 @@ def parse_enum(block): return Enum(name=3Dname, values=3Dvalues) =20 =20 - def parse_method(block): # expected format: method [returns ] header_items =3D block[0][1].split() @@ -1298,7 +1238,6 @@ def parse_method(block): return Method(name=3Dname, parameters=3Dparameters, returns=3Dreturns) =20 =20 - def is_known_type(type): return type in predefined_objects or \ type in predefined_enums or \ @@ -1307,7 +1246,6 @@ def is_known_type(type): type in enums_by_name =20 =20 - def open_and_print(filename): if filename.startswith("./"): print(" GEN " + filename[2:]) @@ -1317,7 +1255,6 @@ def open_and_print(filename): return open(filename, "wt") =20 =20 - predefined_enums =3D ["Boolean"] =20 predefined_objects =3D ["AnyType", @@ -1380,7 +1317,6 @@ additional_object_features =3D { removed_object_features =3D {} =20 =20 - if "srcdir" in os.environ: input_filename =3D os.path.join(os.environ["srcdir"], "esx/esx_vi_gene= rator.input") output_dirname =3D os.path.join(os.environ["srcdir"], "esx") @@ -1389,7 +1325,6 @@ else: output_dirname =3D os.getcwd() =20 =20 - types_typedef =3D open_and_print(os.path.join(output_dirname, "esx_vi_type= s.generated.typedef")) types_typeenum =3D open_and_print(os.path.join(output_dirname, "esx_vi_typ= es.generated.typeenum")) types_typetostring =3D open_and_print(os.path.join(output_dirname, "esx_vi= _types.generated.typetostring")) @@ -1403,7 +1338,6 @@ helpers_header =3D open_and_print(os.path.join(output= _dirname, "esx_vi.generated.h helpers_source =3D open_and_print(os.path.join(output_dirname, "esx_vi.gen= erated.c")) =20 =20 - number =3D 0 objects_by_name =3D {} managed_objects_by_name =3D {} @@ -1412,7 +1346,6 @@ methods_by_name =3D {} block =3D None =20 =20 - # parse input file for line in open(input_filename, "rt").readlines(): number +=3D 1 @@ -1452,7 +1385,6 @@ for line in open(input_filename, "rt").readlines(): block.append((number, line)) =20 =20 - for method in methods_by_name.values(): # method parameter types must be serializable for parameter in method.parameters: @@ -1492,7 +1424,6 @@ for method in methods_by_name.values(): objects_by_name[method.returns.type].features |=3D Object.= FEATURE__LIST =20 =20 - for enum in enums_by_name.values(): # apply additional features if enum.name in additional_enum_features: @@ -1502,7 +1433,6 @@ for enum in enums_by_name.values(): enum.features |=3D Enum.FEATURE__DESERIALIZE =20 =20 - for obj in objects_by_name.values(): for property in obj.properties: if property.occurrence !=3D OCCURRENCE__IGNORED and \ @@ -1554,7 +1484,6 @@ for obj in objects_by_name.values(): extended_obj.extended_by.sort() =20 =20 - for obj in objects_by_name.values(): # if an object is a candidate (it is used directly as parameter or ret= urn # type or is a member of another object) and it is extended by another @@ -1563,7 +1492,6 @@ for obj in objects_by_name.values(): obj.features |=3D Object.FEATURE__DYNAMIC_CAST =20 =20 - def propagate_feature(obj, feature): global features_have_changed =20 @@ -1593,7 +1521,6 @@ def propagate_feature(obj, feature): propagate_feature(objects_by_name[property.type], feature) =20 =20 - def inherit_features(obj): global features_have_changed =20 @@ -1617,7 +1544,6 @@ def inherit_features(obj): inherit_features(objects_by_name[extended_by]) =20 =20 - # there are two directions to spread features: # 1) up and down the inheritance chain # 2) from object types to their member property types @@ -1637,7 +1563,6 @@ while features_have_changed: inherit_features(obj) =20 =20 - for obj in managed_objects_by_name.values(): for property in obj.properties: if property.occurrence !=3D OCCURRENCE__IGNORED and \ @@ -1661,7 +1586,6 @@ for obj in managed_objects_by_name.values(): extended_obj.extended_by.sort() =20 =20 - notice =3D "/* Generated by esx_vi_generator.py */\n\n\n\n" =20 types_typedef.write(notice) @@ -1677,7 +1601,6 @@ helpers_header.write(notice) helpers_source.write(notice) =20 =20 - # output enums types_typedef.write(separator + " * VI Enums\n" + @@ -1694,7 +1617,6 @@ for name in names: types_source.write(enums_by_name[name].generate_source()) =20 =20 - # output objects types_typedef.write("\n\n\n" + separator + @@ -1715,7 +1637,6 @@ for name in names: types_source.write(objects_by_name[name].generate_source()) =20 =20 - # output managed objects types_typedef.write("\n\n\n" + separator + @@ -1736,7 +1657,6 @@ for name in names: types_source.write(managed_objects_by_name[name].generate_source()) =20 =20 - # output methods names =3D sorted(methods_by_name.keys()) =20 @@ -1755,7 +1675,6 @@ for name in names: methods_macro.write(string) =20 =20 - # output helpers names =3D sorted(managed_objects_by_name.keys()) =20 diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index 4f486913bd..64a198a12c 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -30,6 +30,7 @@ separator =3D "/*" + ("*" * 50) + "*\n" wmi_version_separator =3D "/" wmi_classes_by_name =3D {} =20 + class WmiClass: """Represents WMI class and provides methods to generate C code. =20 @@ -49,7 +50,6 @@ class WmiClass: self.versions =3D versions if versions else list() self.common =3D None =20 - def prepare(self): """Prepares the class for code generation =20 @@ -73,7 +73,6 @@ class WmiClass: # are in the same order - to ensure C struct member alignment self._align_property_members() =20 - def generate_classes_header(self): """Generate C header code and return it as string =20 @@ -102,7 +101,6 @@ class WmiClass: =20 return header =20 - def generate_classes_source(self): """Returns a C code string defining wsman data structs =20 @@ -132,13 +130,11 @@ class WmiClass: source +=3D ' { "", "", 0 },\n' # null terminated source +=3D '};\n\n' =20 - source +=3D self._define_WmiInfo_struct() source +=3D "\n\n" =20 return source =20 - def generate_classes_typedef(self): """Returns C string for typdefs""" =20 @@ -152,8 +148,6 @@ class WmiClass: =20 return typedef =20 - - def _declare_data_structs(self): """Returns string C code declaring data structs. =20 @@ -184,7 +178,6 @@ class WmiClass: =20 return header =20 - def _declare_hypervObject_struct(self): """Return string for C code declaring hypervObject instance""" =20 @@ -211,7 +204,6 @@ class WmiClass: =20 return header =20 - def _define_WmiInfo_struct(self): """Return string for C code defining *_WmiInfo struct =20 @@ -241,7 +233,6 @@ class WmiClass: =20 return source =20 - def _align_property_members(self): """Identifies common properties in all class versions. =20 @@ -308,7 +299,6 @@ class WmiClass: self.common.append(x[0]) =20 =20 - class ClassUriInfo: """Prepares URI information needed for wsman requests.""" =20 @@ -328,7 +318,6 @@ class ClassUriInfo: self.resourceUri =3D "%s/%s" % (baseUri, wmi_name) =20 =20 - class WmiClassVersion: """Represents specific version of WMI class.""" =20 @@ -339,7 +328,6 @@ class WmiClassVersion: self.uri_info =3D uri_info =20 =20 - class Property: typemap =3D { "boolean": "BOOL", @@ -359,7 +347,6 @@ class Property: "uint64": "UINT64" } =20 - def __init__(self, type, name, is_array): if type not in Property.typemap: report_error("unhandled property type %s" % type) @@ -368,7 +355,6 @@ class Property: self.name =3D name self.is_array =3D is_array =20 - def generate_classes_header(self): if self.is_array: return " XML_TYPE_DYN_ARRAY %s;\n" % self.name @@ -376,7 +362,6 @@ class Property: return " XML_TYPE_%s %s;\n" \ % (Property.typemap[self.type], self.name) =20 - def generate_classes_source(self, class_name): if self.is_array: return " SER_NS_DYN_ARRAY(%s_RESOURCE_URI, \"%s\", 0, 0, %s= ),\n" \ @@ -385,12 +370,10 @@ class Property: return " SER_NS_%s(%s_RESOURCE_URI, \"%s\", 1),\n" \ % (Property.typemap[self.type], class_name.upper(), sel= f.name) =20 - def generate_typemap(self): return ' { "%s", "%s", %s },\n' % (self.name, self.type.lower()= , str(self.is_array).lower()) =20 =20 - def open_and_print(filename): if filename.startswith("./"): print(" GEN " + filename[2:]) @@ -400,13 +383,11 @@ def open_and_print(filename): return open(filename, "wt") =20 =20 - def report_error(message): print("error: " + message) sys.exit(1) =20 =20 - def parse_class(block, number): # expected format: class header_items =3D block[0][1].split() @@ -452,7 +433,6 @@ def parse_class(block, number): wmi_classes_by_name[wmi_name] =3D WmiClass(wmi_name, [cls]) =20 =20 - def main(): if "srcdir" in os.environ: input_filename =3D os.path.join(os.environ["srcdir"], "hyperv/hype= rv_wmi_generator.input") @@ -513,6 +493,5 @@ def main(): classes_source.write(cls.generate_classes_source()) =20 =20 - if __name__ =3D=3D "__main__": main() diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index ae3cf5996a..40b6c19c23 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -5,6 +5,7 @@ import sys import json import xmltodict =20 + def checkCPUIDFeature(cpuData, feature): eax_in =3D feature["eax_in"] ecx_in =3D feature["ecx_in"] --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625970; cv=none; d=zoho.com; s=zohoarc; b=FujbKUS4GED5XZSiioCEuRIhrpCO7iEZlnQfJT3I0CmvwHhrvIjYoE+/eTknxchZYie4RAB05SZ/wg+DtSajCIdfD7mTNbzXvr6vEoJg9t4j5OoM/p4T6kCitjkWKJ+9cLNv5Zcf81O0V40/ynENFvluQuOgjyRldL2LHtDNINk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625970; h=Content-Type:Content-Transfer-Encoding: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=c6z+v8mBT/k9rS1f3kbwM14aU1FsfGd+0MPin+TGa/U=; b=QgiKKthQYY6TSPsGop+YfPYTvE2gFUYemp2wAKNg224ncWBsatLAprNap2WU6DSHZnzgRh+upkhnqXnLHrXEOH0x0XsWH74BGItPInpeh5FUZbdJPywAOfvQjxRfUdFTdXYhr8ATym4BvN4T5lPm3PbZYNoCNWNrRcOTPh+Gb98= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15706259703871001.3744542021466; Wed, 9 Oct 2019 05:59:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D2E2B793FF; Wed, 9 Oct 2019 12:59:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC4FF1001B11; Wed, 9 Oct 2019 12:59:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6BA0E180085A; Wed, 9 Oct 2019 12:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CxKiO003044 for ; Wed, 9 Oct 2019 08:59:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A3B35DD78; Wed, 9 Oct 2019 12:59:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id D30285DC18; Wed, 9 Oct 2019 12:59:17 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:42 +0100 Message-Id: <20191009125844.18202-9-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] python: sanitize spaces either side of operators X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 09 Oct 2019 12:59:29 +0000 (UTC) There should be a single space either side of operators. Inline comments should have two spaces before the '#' src/hyperv/hyperv_wmi_generator.py:130:45: E261 at least two spaces before = inline comment source +=3D ' { "", "", 0 },\n' # null terminated ^ src/esx/esx_vi_generator.py:417:25: E221 multiple spaces before operator FEATURE__DESERIALIZE =3D (1 << 6) ^ tests/cputestdata/cpu-cpuid.py:187:78: E225 missing whitespace around opera= tor f.write(" \n" %( = ^ docs/apibuild.py:524:47: E226 missing whitespace around arithmetic operator self.line =3D line[i+2:] ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 -- docs/apibuild.py | 16 ++++++++-------- src/esx/esx_vi_generator.py | 12 ++++++------ src/hyperv/hyperv_wmi_generator.py | 2 +- tests/cputestdata/cpu-cpuid.py | 4 ++-- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index c6d7ad1b9d..1dcf9f169c 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -880,12 +880,10 @@ sc_require_enum_last_marker: =20 # Validate many python style rules FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E127,E128,E129,E131 -FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_LINE_LENGTH =3D E501 FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ - $(FLAKE8_WHITESPACE),$\ $(FLAKE8_LINE_LENGTH),$\ $(FLAKE8_WARNINGS) \ $(NULL) diff --git a/docs/apibuild.py b/docs/apibuild.py index e944c01321..bdf217f52c 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -520,9 +520,9 @@ class CLexer: i =3D 0 nline =3D len(line) while i < nline: - if line[i] =3D=3D '*' and i+1 < nline and line[i+1= ] =3D=3D '/': - self.line =3D line[i+2:] - line =3D line[:i-1] + if line[i] =3D=3D '*' and i + 1 < nline and line[i= + 1] =3D=3D '/': + self.line =3D line[i + 2:] + line =3D line[:i - 1] nline =3D i found =3D 1 break @@ -542,11 +542,11 @@ class CLexer: return self.last i =3D 0 while i < nline: - if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '/': + if line[i] =3D=3D '/' and i + 1 < nline and line[i + 1] = =3D=3D '/': self.line =3D line[i:] line =3D line[:i] break - if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '*': + if line[i] =3D=3D '/' and i + 1 < nline and line[i + 1] = =3D=3D '*': self.line =3D line[i:] line =3D line[:i] break @@ -576,14 +576,14 @@ class CLexer: continue if line[i] in "+-*><=3D/%&!|.": if line[i] =3D=3D '.' and i + 2 < nline and \ - line[i+1] =3D=3D '.' and line[i+2] =3D=3D '.': + line[i + 1] =3D=3D '.' and line[i + 2] =3D=3D '.': self.tokens.append(('name', '...')) i =3D i + 3 continue =20 j =3D i + 1 if j < nline and line[j] in "+-*><=3D/%&!|": - self.tokens.append(('op', line[i:j+1])) + self.tokens.append(('op', line[i:j + 1])) i =3D j + 1 else: self.tokens.append(('op', line[i])) @@ -994,7 +994,7 @@ class CParser: lst.append(token[1]) token =3D self.lexer.token() try: - name =3D name.split('(') [0] + name =3D name.split('(')[0] except Exception: pass =20 diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 2310b56ad0..d6e5e1c7cd 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -402,7 +402,7 @@ class Type: return string =20 def generate_typefromstring(self): - string =3D " if (STREQ(type, \"%s\"))\n" % self.name + string =3D " if (STREQ(type, \"%s\"))\n" % self.name string +=3D " return esxVI_Type_%s;\n" % self.name =20 return string @@ -410,11 +410,11 @@ class Type: =20 class GenericObject(Type): FEATURE__DYNAMIC_CAST =3D (1 << 1) - FEATURE__LIST =3D (1 << 2) - FEATURE__DEEP_COPY =3D (1 << 3) - FEATURE__ANY_TYPE =3D (1 << 4) - FEATURE__SERIALIZE =3D (1 << 5) - FEATURE__DESERIALIZE =3D (1 << 6) + FEATURE__LIST =3D (1 << 2) + FEATURE__DEEP_COPY =3D (1 << 3) + FEATURE__ANY_TYPE =3D (1 << 4) + FEATURE__SERIALIZE =3D (1 << 5) + FEATURE__DESERIALIZE =3D (1 << 6) =20 def __init__(self, name, category, managed, generic_objects_by_name): Type.__init__(self, "struct", name) diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index 64a198a12c..02d948f98d 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -127,7 +127,7 @@ class WmiClass: =20 for property in cls.properties: source +=3D property.generate_typemap() - source +=3D ' { "", "", 0 },\n' # null terminated + source +=3D ' { "", "", 0 },\n' # null terminated source +=3D '};\n\n' =20 source +=3D self._define_WmiInfo_struct() diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 40b6c19c23..37d00e3c97 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -184,8 +184,8 @@ def formatCPUData(cpuData, path, comment): if "msr" in cpuData: msr =3D cpuData["msr"] for index in sorted(msr.keys()): - f.write(" \n" %( - index, msr[index]['edx'], msr[index]['eax'])) + f.write(" \n" % + (index, msr[index]['edx'], msr[index]['eax'])) =20 f.write("\n") =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625966; cv=none; d=zoho.com; s=zohoarc; b=XtnPZN8Aa8ZiCDjSHXbWUxbIf7A+of9uG9f+IugJfLfKTltQwPrWEd0Wj30HsLhv7d8VBfWQe5Kyee7AxIs2H1KWz2VULSetYS1sd4lHbBlcPJHzBFOM8hLbACY4mayjj4gmuVFM0I6aEJDmWqc6Q0JdynxNO7ja5LrENTf6GW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625966; h=Content-Type:Content-Transfer-Encoding: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=coeSVD5GcmJYjzJDakXpYAa/2cqK0mmUSjwwj7i9fYA=; b=d3SeJCSGLfpAYfsMH+vDqRVzjn8OlK5e4S2al1e+Cd5ScVC0I6h6wExOGY2c5tZUUZP07g7Qqzjj2m8uMF3Y10I9FaJL18LI6pfuCZiejSijw4zSCis71jz4+vf++ROex0Jt3a/q/Mw7PDke8J89DpxvJzSIAgJPNzXD0koXukg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625966992573.9545400437288; Wed, 9 Oct 2019 05:59:26 -0700 (PDT) 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 0161289810D; Wed, 9 Oct 2019 12:59:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA8F75DA8D; Wed, 9 Oct 2019 12:59:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7F9824EE6A; Wed, 9 Oct 2019 12:59:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CxNqx003066 for ; Wed, 9 Oct 2019 08:59:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 593AD5DA8D; Wed, 9 Oct 2019 12:59:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A86C5DA2C; Wed, 9 Oct 2019 12:59:20 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:43 +0100 Message-Id: <20191009125844.18202-10-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/10] python: sanitize indentation after line continuations X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Wed, 09 Oct 2019 12:59:25 +0000 (UTC) Line continuations should be 4 space indented unless a previous opening brace required different alignment. docs/apibuild.py:2014:24: E126 continuation line over-indented for hanging = indent token[0], token[1])) ^ docs/apibuild.py:74:3: E121 continuation line under-indented for hanging in= dent "ATTRIBUTE_UNUSED": (0, "macro keyword"), ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 4 +- docs/apibuild.py | 242 ++++++++++++++++++------------------ src/esx/esx_vi_generator.py | 144 +++++++++++---------- 3 files changed, 200 insertions(+), 190 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 1dcf9f169c..ebacb8312e 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -879,12 +879,10 @@ sc_require_enum_last_marker: exit 1; } || : =20 # Validate many python style rules -FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E127,E128,E129,E131 FLAKE8_LINE_LENGTH =3D E501 FLAKE8_WARNINGS =3D W504 =20 -FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ - $(FLAKE8_LINE_LENGTH),$\ +FLAKE8_IGNORE =3D $(FLAKE8_LINE_LENGTH),$\ $(FLAKE8_WARNINGS) \ $(NULL) =20 diff --git a/docs/apibuild.py b/docs/apibuild.py index bdf217f52c..5fe2c2dc77 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -24,103 +24,103 @@ debugsym =3D None # C parser analysis code # included_files =3D { - "libvirt-common.h": "header with general libvirt API definitions", - "libvirt-domain.h": "header with general libvirt API definitions", - "libvirt-domain-checkpoint.h": "header with general libvirt API definiti= ons", - "libvirt-domain-snapshot.h": "header with general libvirt API definition= s", - "libvirt-event.h": "header with general libvirt API definitions", - "libvirt-host.h": "header with general libvirt API definitions", - "libvirt-interface.h": "header with general libvirt API definitions", - "libvirt-network.h": "header with general libvirt API definitions", - "libvirt-nodedev.h": "header with general libvirt API definitions", - "libvirt-nwfilter.h": "header with general libvirt API definitions", - "libvirt-secret.h": "header with general libvirt API definitions", - "libvirt-storage.h": "header with general libvirt API definitions", - "libvirt-stream.h": "header with general libvirt API definitions", - "virterror.h": "header with error specific API definitions", - "libvirt.c": "Main interfaces for the libvirt library", - "libvirt-domain.c": "Domain interfaces for the libvirt library", - "libvirt-domain-checkpoint.c": "Domain checkpoint interfaces for the lib= virt library", - "libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvirt= library", - "libvirt-host.c": "Host interfaces for the libvirt library", - "libvirt-interface.c": "Interface interfaces for the libvirt library", - "libvirt-network.c": "Network interfaces for the libvirt library", - "libvirt-nodedev.c": "Node device interfaces for the libvirt library", - "libvirt-nwfilter.c": "NWFilter interfaces for the libvirt library", - "libvirt-secret.c": "Secret interfaces for the libvirt library", - "libvirt-storage.c": "Storage interfaces for the libvirt library", - "libvirt-stream.c": "Stream interfaces for the libvirt library", - "virerror.c": "implements error handling and reporting code for libvirt", - "virevent.c": "event loop for monitoring file handles", - "virtypedparam-public.c": "virTypedParameters APIs", + "libvirt-common.h": "header with general libvirt API definitions", + "libvirt-domain.h": "header with general libvirt API definitions", + "libvirt-domain-checkpoint.h": "header with general libvirt API defini= tions", + "libvirt-domain-snapshot.h": "header with general libvirt API definiti= ons", + "libvirt-event.h": "header with general libvirt API definitions", + "libvirt-host.h": "header with general libvirt API definitions", + "libvirt-interface.h": "header with general libvirt API definitions", + "libvirt-network.h": "header with general libvirt API definitions", + "libvirt-nodedev.h": "header with general libvirt API definitions", + "libvirt-nwfilter.h": "header with general libvirt API definitions", + "libvirt-secret.h": "header with general libvirt API definitions", + "libvirt-storage.h": "header with general libvirt API definitions", + "libvirt-stream.h": "header with general libvirt API definitions", + "virterror.h": "header with error specific API definitions", + "libvirt.c": "Main interfaces for the libvirt library", + "libvirt-domain.c": "Domain interfaces for the libvirt library", + "libvirt-domain-checkpoint.c": "Domain checkpoint interfaces for the l= ibvirt library", + "libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvi= rt library", + "libvirt-host.c": "Host interfaces for the libvirt library", + "libvirt-interface.c": "Interface interfaces for the libvirt library", + "libvirt-network.c": "Network interfaces for the libvirt library", + "libvirt-nodedev.c": "Node device interfaces for the libvirt library", + "libvirt-nwfilter.c": "NWFilter interfaces for the libvirt library", + "libvirt-secret.c": "Secret interfaces for the libvirt library", + "libvirt-storage.c": "Storage interfaces for the libvirt library", + "libvirt-stream.c": "Stream interfaces for the libvirt library", + "virerror.c": "implements error handling and reporting code for libvir= t", + "virevent.c": "event loop for monitoring file handles", + "virtypedparam-public.c": "virTypedParameters APIs", } =20 qemu_included_files =3D { - "libvirt-qemu.h": "header with QEMU specific API definitions", - "libvirt-qemu.c": "Implementations for the QEMU specific APIs", + "libvirt-qemu.h": "header with QEMU specific API definitions", + "libvirt-qemu.c": "Implementations for the QEMU specific APIs", } =20 lxc_included_files =3D { - "libvirt-lxc.h": "header with LXC specific API definitions", - "libvirt-lxc.c": "Implementations for the LXC specific APIs", + "libvirt-lxc.h": "header with LXC specific API definitions", + "libvirt-lxc.c": "Implementations for the LXC specific APIs", } =20 admin_included_files =3D { - "libvirt-admin.h": "header with admin specific API definitions", - "libvirt-admin.c": "Implementations for the admin specific APIs", + "libvirt-admin.h": "header with admin specific API definitions", + "libvirt-admin.c": "Implementations for the admin specific APIs", } =20 ignored_words =3D { - "ATTRIBUTE_UNUSED": (0, "macro keyword"), - "ATTRIBUTE_SENTINEL": (0, "macro keyword"), - "VIR_DEPRECATED": (0, "macro keyword"), - "VIR_EXPORT_VAR": (0, "macro keyword"), - "WINAPI": (0, "Windows keyword"), - "__declspec": (3, "Windows keyword"), - "__stdcall": (0, "Windows keyword"), + "ATTRIBUTE_UNUSED": (0, "macro keyword"), + "ATTRIBUTE_SENTINEL": (0, "macro keyword"), + "VIR_DEPRECATED": (0, "macro keyword"), + "VIR_EXPORT_VAR": (0, "macro keyword"), + "WINAPI": (0, "Windows keyword"), + "__declspec": (3, "Windows keyword"), + "__stdcall": (0, "Windows keyword"), } =20 ignored_functions =3D { - "virConnectSupportsFeature": "private function for remote access", - "virDomainMigrateFinish": "private function for migration", - "virDomainMigrateFinish2": "private function for migration", - "virDomainMigratePerform": "private function for migration", - "virDomainMigratePrepare": "private function for migration", - "virDomainMigratePrepare2": "private function for migration", - "virDomainMigratePrepareTunnel": "private function for tunnelled migrati= on", - "virDomainMigrateBegin3": "private function for migration", - "virDomainMigrateFinish3": "private function for migration", - "virDomainMigratePerform3": "private function for migration", - "virDomainMigratePrepare3": "private function for migration", - "virDomainMigrateConfirm3": "private function for migration", - "virDomainMigratePrepareTunnel3": "private function for tunnelled migrat= ion", - "DllMain": "specific function for Win32", - "virTypedParamsValidate": "internal function in virtypedparam.c", - "virTypedParameterValidateSet": "internal function in virtypedparam.c", - "virTypedParameterAssign": "internal function in virtypedparam.c", - "virTypedParameterAssignFromStr": "internal function in virtypedparam.c", - "virTypedParameterToString": "internal function in virtypedparam.c", - "virTypedParamsCheck": "internal function in virtypedparam.c", - "virTypedParamsCopy": "internal function in virtypedparam.c", - "virDomainMigrateBegin3Params": "private function for migration", - "virDomainMigrateFinish3Params": "private function for migration", - "virDomainMigratePerform3Params": "private function for migration", - "virDomainMigratePrepare3Params": "private function for migration", - "virDomainMigrateConfirm3Params": "private function for migration", - "virDomainMigratePrepareTunnel3Params": "private function for tunnelled = migration", - "virErrorCopyNew": "private", + "virConnectSupportsFeature": "private function for remote access", + "virDomainMigrateFinish": "private function for migration", + "virDomainMigrateFinish2": "private function for migration", + "virDomainMigratePerform": "private function for migration", + "virDomainMigratePrepare": "private function for migration", + "virDomainMigratePrepare2": "private function for migration", + "virDomainMigratePrepareTunnel": "private function for tunnelled migra= tion", + "virDomainMigrateBegin3": "private function for migration", + "virDomainMigrateFinish3": "private function for migration", + "virDomainMigratePerform3": "private function for migration", + "virDomainMigratePrepare3": "private function for migration", + "virDomainMigrateConfirm3": "private function for migration", + "virDomainMigratePrepareTunnel3": "private function for tunnelled migr= ation", + "DllMain": "specific function for Win32", + "virTypedParamsValidate": "internal function in virtypedparam.c", + "virTypedParameterValidateSet": "internal function in virtypedparam.c", + "virTypedParameterAssign": "internal function in virtypedparam.c", + "virTypedParameterAssignFromStr": "internal function in virtypedparam.= c", + "virTypedParameterToString": "internal function in virtypedparam.c", + "virTypedParamsCheck": "internal function in virtypedparam.c", + "virTypedParamsCopy": "internal function in virtypedparam.c", + "virDomainMigrateBegin3Params": "private function for migration", + "virDomainMigrateFinish3Params": "private function for migration", + "virDomainMigratePerform3Params": "private function for migration", + "virDomainMigratePrepare3Params": "private function for migration", + "virDomainMigrateConfirm3Params": "private function for migration", + "virDomainMigratePrepareTunnel3Params": "private function for tunnelle= d migration", + "virErrorCopyNew": "private", } =20 ignored_macros =3D { - "_virSchedParameter": "backward compatibility macro for virTypedParamete= r", - "_virBlkioParameter": "backward compatibility macro for virTypedParamete= r", - "_virMemoryParameter": "backward compatibility macro for virTypedParamet= er", + "_virSchedParameter": "backward compatibility macro for virTypedParame= ter", + "_virBlkioParameter": "backward compatibility macro for virTypedParame= ter", + "_virMemoryParameter": "backward compatibility macro for virTypedParam= eter", } =20 # macros that should be completely skipped hidden_macros =3D { - "VIR_DEPRECATED": "internal macro to mark deprecated apis", - "VIR_EXPORT_VAR": "internal macro to mark exported vars", + "VIR_DEPRECATED": "internal macro to mark deprecated apis", + "VIR_EXPORT_VAR": "internal macro to mark exported vars", } =20 =20 @@ -909,8 +909,8 @@ class CParser: i =3D i + 1 if i >=3D nbargs: if not quiet: - self.warning("Unable to find arg %s from function comm= ent for %s" % ( - arg, name)) + self.warning("Unable to find arg %s from function comm= ent for %s" % + (arg, name)) while len(lines) > 0 and lines[0] =3D=3D '*': del lines[0] desc =3D None @@ -977,7 +977,7 @@ class CParser: return None if token[0] =3D=3D 'preproc': self.index_add(token[1], self.filename, not self.is_header, - "include") + "include") return self.lexer.token() return token if name =3D=3D "#define": @@ -989,8 +989,8 @@ class CParser: name =3D token[1] lst =3D [] token =3D self.lexer.token() - while token is not None and token[0] =3D=3D 'preproc' and \ - token[1][0] !=3D '#': + while (token is not None and token[0] =3D=3D 'preproc' and + token[1][0] !=3D '#'): lst.append(token[1]) token =3D self.lexer.token() try: @@ -1058,17 +1058,17 @@ class CParser: except Exception: pass elif name =3D=3D "#else": - if self.conditionals !=3D [] and \ - self.defines[-1].find('ENABLED') !=3D -1: + if (self.conditionals !=3D [] and + self.defines[-1].find('ENABLED') !=3D -1): self.conditionals[-1] =3D "!(%s)" % self.conditionals[-1] elif name =3D=3D "#endif": - if self.conditionals !=3D [] and \ - self.defines[-1].find('ENABLED') !=3D -1: + if (self.conditionals !=3D [] and + self.defines[-1].find('ENABLED') !=3D -1): self.conditionals =3D self.conditionals[:-1] self.defines =3D self.defines[:-1] token =3D self.lexer.token() - while token is not None and token[0] =3D=3D 'preproc' and \ - token[1][0] !=3D '#': + while (token is not None and token[0] =3D=3D 'preproc' and + token[1][0] !=3D '#'): token =3D self.lexer.token() return token =20 @@ -1133,19 +1133,19 @@ class CParser: if signature is not None: type =3D type.split('(')[0] d =3D self.mergeFunctionComment(name, - ((type, None), signature), 1) + ((type, None), signature= ), 1) self.index_add(name, self.filename, not self.is_header, - "functype", d) + "functype", d) else: if base_type =3D=3D "struct": self.index_add(name, self.filename, not self.is_he= ader, - "struct", type) + "struct", type) base_type =3D "struct " + name else: # TODO report missing or misformatted comments info =3D self.parseTypeComment(name, 1) self.index_add(name, self.filename, not self.is_he= ader, - "typedef", type, info) + "typedef", type, info) token =3D self.token() else: self.error("parsing typedef: expecting a name") @@ -1188,20 +1188,20 @@ class CParser: if oldtok[0] =3D=3D "name" and oldtok[1][0:3] =3D=3D "= vir": if token[0] =3D=3D "sep" and token[1] =3D=3D "(": self.index_add_ref(oldtok[1], self.filename, - 0, "function") + 0, "function") token =3D self.token() elif token[0] =3D=3D "name": token =3D self.token() if token[0] =3D=3D "sep" and (token[1] =3D=3D = ";" or token[1] =3D=3D "," or token[1] =3D=3D "=3D= "): self.index_add_ref(oldtok[1], self.filenam= e, - 0, "type") + 0, "type") elif oldtok[0] =3D=3D "name" and oldtok[1][0:4] =3D=3D= "XEN_": self.index_add_ref(oldtok[1], self.filename, - 0, "typedef") + 0, "typedef") elif oldtok[0] =3D=3D "name" and oldtok[1][0:7] =3D=3D= "LIBXEN_": self.index_add_ref(oldtok[1], self.filename, - 0, "typedef") + 0, "typedef") =20 else: token =3D self.token() @@ -1350,7 +1350,7 @@ class CParser: value =3D token[1][1:] token =3D self.token() while token[0] !=3D "sep" or (token[1] !=3D ',' and - token[1] !=3D '}'): + token[1] !=3D '}'): # We might be dealing with '1U << 12' here value =3D value + re.sub(r"^(\d+)U$", "\\1", token= [1]) token =3D self.token() @@ -1670,7 +1670,8 @@ class CParser: return token token =3D self.token() while token is not None and (token[0] =3D=3D "op" or - token[0] =3D=3D "name" and token[1] =3D=3D "const"): + token[0] =3D=3D "name" and + token[1] =3D=3D "const"): self.type =3D self.type + " " + token[1] token =3D self.token() =20 @@ -1718,8 +1719,8 @@ class CParser: while token is not None and token[0] =3D=3D "sep" and toke= n[1] =3D=3D '[': self.type =3D self.type + token[1] token =3D self.token() - while token is not None and token[0] !=3D 'sep' and \ - token[1] !=3D ']' and token[1] !=3D ';': + while (token is not None and token[0] !=3D 'sep' and + token[1] !=3D ']' and token[1] !=3D ';'): self.type =3D self.type + token[1] token =3D self.token() if token is not None and token[0] =3D=3D 'sep' and token[1= ] =3D=3D ']': @@ -1868,13 +1869,13 @@ class CParser: token =3D self.token() # print('Entering extern "C line ', self.lineno()) while token is not None and (token[0] !=3D 'sep' or - token[1] !=3D "}"): + token[1] !=3D "}"): if token[0] =3D=3D 'name': token =3D self.parseGlobal(token) else: - self.error( - "token %s %s unexpected at the top level"= % ( - token[0], token[1])) + self.error(("token %s %s unexpected at the= " + "top level") % + (token[0], token[1])) token =3D self.parseGlobal(token) # print('Exiting extern "C" line', self.lineno()) token =3D self.token() @@ -1933,10 +1934,11 @@ class CParser: if type =3D=3D "struct": self.checkLongLegacyStruct(self.name, self.struct_= fields) self.index_add(self.name, self.filename, - not self.is_header, "struct", self.struct_fie= lds) + not self.is_header, "struct", + self.struct_fields) else: self.index_add(self.name, self.filename, - not self.is_header, "variable", type) + not self.is_header, "variable", typ= e) break elif token[1] =3D=3D "(": token =3D self.token() @@ -1946,22 +1948,24 @@ class CParser: if token[0] =3D=3D "sep" and token[1] =3D=3D ";": self.checkLongLegacyFunction(self.name, type, self= .signature) d =3D self.mergeFunctionComment(self.name, - ((type, None), self.signature), 1) + ((type, None), + self.signature), 1) self.index_add(self.name, self.filename, static, - "function", d) + "function", d) token =3D self.token() elif token[0] =3D=3D "sep" and token[1] =3D=3D "{": self.checkLongLegacyFunction(self.name, type, self= .signature) d =3D self.mergeFunctionComment(self.name, - ((type, None), self.signature), static) + ((type, None), + self.signature), st= atic) self.index_add(self.name, self.filename, static, - "function", d) + "function", d) token =3D self.token() token =3D self.parseBlock(token) elif token[1] =3D=3D ',': self.comment =3D None self.index_add(self.name, self.filename, static, - "variable", type) + "variable", type) type =3D type_orig token =3D self.token() while token is not None and token[0] =3D=3D "sep": @@ -1984,7 +1988,7 @@ class CParser: token =3D self.parseGlobal(token) else: self.error("token %s %s unexpected at the top level" % ( - token[0], token[1])) + token[0], token[1])) token =3D self.parseGlobal(token) return self.parseTopComment(self.top_comment) @@ -2182,7 +2186,7 @@ class docBuilder: id =3D self.idx.typedefs[name] if id.info[0:7] =3D=3D 'struct ': output.write(" \n" % ( - name, self.modulename_file(id.header), id.info)) + name, self.modulename_file(id.header), id.info)) else: output.write(" \n" % ( - name, self.modulename_file(id.header))) + name, self.modulename_file(id.header))) =20 def serialize_function(self, output, name): id =3D self.idx.functions[name] @@ -2256,7 +2260,7 @@ class docBuilder: self.error("Missing documentation for return of functi= on `%s'" % name) else: output.write(" \= n" % ( - ret[0], escape(ret[1]))) + ret[0], escape(ret[1]))) self.indexString(name, ret[1]) for param in params: if param[0] =3D=3D 'void': @@ -2407,10 +2411,10 @@ class docBuilder: for id in typ: idf =3D self.idx.identifiers[id] module =3D idf.header - output.write(" \n" % (i= d, - 'html/' + self.basename + '-' + - self.modulename_file(module) + '.html#' + - id)) + output.write(" \n" % + (id, 'html/' + self.basename + '-' + + self.modulename_file(module) + '.html#' + + id)) =20 def serialize_xrefs_index(self, output): index =3D self.xref @@ -2548,7 +2552,7 @@ class app: srcdir + "/../src/util", srcdir + "/../include/libvirt"] if (builddir and - not os.path.exists(srcdir + "/../include/libvirt/libvirt-c= ommon.h")): + not os.path.exists(srcdir + "/../include/libvirt/libvi= rt-common.h")): dirs.append(builddir + "/../include/libvirt") builder =3D docBuilder(name, srcdir, dirs, []) elif glob.glob("src/libvirt.c") !=3D []: diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index d6e5e1c7cd..3242513b71 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -453,9 +453,9 @@ class GenericObject(Type): members +=3D "\n" =20 if self.extends is not None: - members +=3D self.generic_objects_by_name[self.extends] \ - .generate_struct_members(add_banner=3DTrue, - struct_gap=3DFalse) + "\n" + obj =3D self.generic_objects_by_name[self.extends] + members +=3D obj.generate_struct_members(add_banner=3DTrue, + struct_gap=3DFalse) + "= \n" =20 if self.extends is not None or add_banner: members +=3D " /* %s */\n" % self.name @@ -482,8 +482,8 @@ class GenericObject(Type): % (suffix, extended_by) =20 for extended_by in self.extended_by: - source +=3D self.generic_objects_by_name[extended_by] \ - .generate_dispatch(suffix, False) + obj =3D self.generic_objects_by_name[extended_by] + source +=3D obj.generate_dispatch(suffix, False) =20 return source =20 @@ -491,8 +491,8 @@ class GenericObject(Type): source =3D "" =20 if self.extends is not None: - source +=3D self.generic_objects_by_name[self.extends] \ - .generate_free_code(add_banner=3DTrue) + "\n" + obj =3D self.generic_objects_by_name[self.extends] + source +=3D obj.generate_free_code(add_banner=3DTrue) + "\n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -516,8 +516,8 @@ class GenericObject(Type): source =3D "" =20 if self.extends is not None: - source +=3D self.generic_objects_by_name[self.extends] \ - .generate_validate_code(add_banner=3DTrue) + "\n" + obj =3D self.generic_objects_by_name[self.extends] + source +=3D obj.generate_validate_code(add_banner=3DTrue) + "\= n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -564,8 +564,8 @@ class Object(GenericObject): % extended_by =20 for extended_by in self.extended_by: - source +=3D objects_by_name[extended_by] \ - .generate_dynamic_cast_code(False) + obj =3D objects_by_name[extended_by] + source +=3D obj.generate_dynamic_cast_code(False) =20 return source =20 @@ -573,8 +573,8 @@ class Object(GenericObject): source =3D "" =20 if self.extends is not None: - source +=3D objects_by_name[self.extends] \ - .generate_deep_copy_code(add_banner=3DTrue) + "\n" + obj =3D objects_by_name[self.extends] + source +=3D obj.generate_deep_copy_code(add_banner=3DTrue) + "= \n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -598,8 +598,8 @@ class Object(GenericObject): source =3D "" =20 if self.extends is not None: - source +=3D objects_by_name[self.extends] \ - .generate_serialize_code(add_banner=3DTrue) + "\n" + obj =3D objects_by_name[self.extends] + source +=3D obj.generate_serialize_code(add_banner=3DTrue) + "= \n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -616,8 +616,8 @@ class Object(GenericObject): source =3D "" =20 if self.extends is not None: - source +=3D objects_by_name[self.extends] \ - .generate_deserialize_code(add_banner=3DTrue) + "\n" + obj =3D objects_by_name[self.extends] + source +=3D obj.generate_deserialize_code(add_banner=3DTrue) += "\n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -671,40 +671,46 @@ class Object(GenericObject): % (self.name, self.name, self.name) =20 if self.features & Object.FEATURE__LIST: - header +=3D ("int esxVI_%s_DeepCopyList(esxVI_%s **dstList= , " - "esxVI_%s *srcList);\= n") \ - % (self.name, self.name, self.name) + header +=3D (( + "int esxVI_%s_DeepCopyList(esxVI_%s **dstList, " + " esxVI_%s *srcList);\n") % + (self.name, self.name, self.name)) =20 if self.features & Object.FEATURE__ANY_TYPE: - header +=3D ("int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyT= ype, " - "esxVI_%s **item);\n")= \ - % (self.name, self.name) + header +=3D (( + "int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, " + " esxVI_%s **item);\n") % + (self.name, self.name)) =20 if self.features & Object.FEATURE__LIST: - header +=3D ("int esxVI_%s_CastListFromAnyType(esxVI_AnyTy= pe *anyType, " - "esxVI_%s **li= st);\n") \ - % (self.name, self.name) + header +=3D (( + "int esxVI_%s_CastListFromAnyType(esxVI_AnyType *anyTy= pe, " + " esxVI_%s **list);\n"= ) % + (self.name, self.name)) =20 if self.features & Object.FEATURE__SERIALIZE: - header +=3D ("int esxVI_%s_Serialize(esxVI_%s *item, " - "const char *element, " - "virBufferPtr output);\n") \ - % (self.name, self.name) + header +=3D (( + "int esxVI_%s_Serialize(esxVI_%s *item, " + " const char *element, " + " virBufferPtr output);\n") % + (self.name, self.name)) =20 if self.features & Object.FEATURE__LIST: - header +=3D ("int esxVI_%s_SerializeList(esxVI_%s *list, " - "const char *element= , " - "virBufferPtr output= );\n") \ - % (self.name, self.name) + header +=3D (( + "int esxVI_%s_SerializeList(esxVI_%s *list, " + " const char *element, " + " virBufferPtr output);\n") % + (self.name, self.name)) =20 if self.features & Object.FEATURE__DESERIALIZE: header +=3D "int esxVI_%s_Deserialize(xmlNodePtr node, esxVI_%= s **item);\n" \ % (self.name, self.name) =20 if self.features & Object.FEATURE__LIST: - header +=3D ("int esxVI_%s_DeserializeList(xmlNodePtr node= , " - "esxVI_%s **list);= \n") \ - % (self.name, self.name) + header +=3D (( + "int esxVI_%s_DeserializeList(xmlNodePtr node, " + " esxVI_%s **list);\n") % + (self.name, self.name)) =20 header +=3D "\n\n\n" =20 @@ -887,8 +893,8 @@ class ManagedObject(GenericObject): source =3D "" =20 if self.extends is not None: - source +=3D managed_objects_by_name[self.extends] \ - .generate_lookup_code1(add_banner=3DTrue) + "\n" + obj =3D managed_objects_by_name[self.extends] + source +=3D obj.generate_lookup_code1(add_banner=3DTrue) + "\n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -912,8 +918,8 @@ class ManagedObject(GenericObject): source =3D "" =20 if self.extends is not None: - source +=3D managed_objects_by_name[self.extends] \ - .generate_lookup_code2(add_banner=3DTrue) + "\n" + obj =3D managed_objects_by_name[self.extends] + source +=3D obj.generate_lookup_code2(add_banner=3DTrue) + "\n" =20 if self.extends is not None or add_banner: source +=3D " /* %s */\n" % self.name @@ -957,12 +963,12 @@ class ManagedObject(GenericObject): header +=3D "int esxVI_%s_Alloc(esxVI_%s **item);\n" % (self.name,= self.name) header +=3D "void esxVI_%s_Free(esxVI_%s **item);\n" % (self.name,= self.name) header +=3D ("int esxVI_%s_Validate(esxVI_%s *item, " - "esxVI_String *selectedPropertyNa= meList);\n") \ - % (self.name, self.name) + " esxVI_String *selectedPropertyNa= meList);\n") \ + % (self.name, self.name) =20 if self.features & Object.FEATURE__LIST: header +=3D "int esxVI_%s_AppendToList(esxVI_%s **list, esxVI_= %s *item);\n" \ - % (self.name, self.name, self.name) + % (self.name, self.name, self.name) =20 header +=3D "\n\n\n" =20 @@ -972,11 +978,11 @@ class ManagedObject(GenericObject): # functions return ( "int esxVI_Lookup%(name)s(esxVI_Context *ctx," - " const char *name," - " esxVI_ManagedObjectReference *root," - " esxVI_String *selectedPropertyNameL= ist," - " esxVI_%(name)s **item," - " esxVI_Occurrence occurrence);\n\n" + " const char *name," + " esxVI_ManagedObjectReference *root," + " esxVI_String *selectedPropertyNameLi= st," + " esxVI_%(name)s **item," + " esxVI_Occurrence occurrence);\n\n" % {"name": self.name} ) =20 @@ -1074,18 +1080,18 @@ class Enum(Type): # functions if self.features & Enum.FEATURE__ANY_TYPE: header +=3D ("int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyT= ype, " - "esxVI_%s *item);\n") \ - % (self.name, self.name) + " esxVI_%s *item);\n") \ + % (self.name, self.name) =20 if self.features & Enum.FEATURE__SERIALIZE: header +=3D ("int esxVI_%s_Serialize(esxVI_%s item, const char= *element, " - "virBufferPtr output);\n") \ - % (self.name, self.name) + " virBufferPtr output);\n") \ + % (self.name, self.name) =20 if self.features & Enum.FEATURE__DESERIALIZE: header +=3D ("int esxVI_%s_Deserialize(xmlNodePtr node, " - "esxVI_%s *item);\n") \ - % (self.name, self.name) + " esxVI_%s *item);\n") \ + % (self.name, self.name) =20 header +=3D "\n\n\n" =20 @@ -1096,12 +1102,12 @@ class Enum(Type): source +=3D " * VI Enum: %s\n" % self.name source +=3D " */\n\n" source +=3D "static const esxVI_Enumeration _esxVI_%s_Enumeration = =3D {\n" \ - % self.name + % self.name source +=3D " esxVI_Type_%s, {\n" % self.name =20 for value in self.values: source +=3D " { \"%s\", esxVI_%s_%s },\n" \ - % (value, self.name, capitalize_first(value)) + % (value, self.name, capitalize_first(value)) =20 source +=3D " { NULL, -1 },\n" source +=3D " },\n" @@ -1239,11 +1245,11 @@ def parse_method(block): =20 =20 def is_known_type(type): - return type in predefined_objects or \ - type in predefined_enums or \ - type in objects_by_name or \ - type in managed_objects_by_name or \ - type in enums_by_name + return (type in predefined_objects or + type in predefined_enums or + type in objects_by_name or + type in managed_objects_by_name or + type in enums_by_name) =20 =20 def open_and_print(filename): @@ -1499,17 +1505,19 @@ def propagate_feature(obj, feature): return =20 for property in obj.properties: - if property.occurrence =3D=3D OCCURRENCE__IGNORED or \ - not property.is_type_generated(): + if (property.occurrence =3D=3D OCCURRENCE__IGNORED or + not property.is_type_generated()): continue =20 if property.is_enum(): - if feature =3D=3D Object.FEATURE__SERIALIZE and \ - not (enums_by_name[property.type].features & Enum.FEATURE__= SERIALIZE): + if (feature =3D=3D Object.FEATURE__SERIALIZE and + not (enums_by_name[property.type].features & + Enum.FEATURE__SERIALIZE)): enums_by_name[property.type].features |=3D Enum.FEATURE__S= ERIALIZE features_have_changed =3D True - elif feature =3D=3D Object.FEATURE__DESERIALIZE and \ - not (enums_by_name[property.type].features & Enum.FEATURE__= DESERIALIZE): + elif (feature =3D=3D Object.FEATURE__DESERIALIZE and + not (enums_by_name[property.type].features & + Enum.FEATURE__DESERIALIZE)): enums_by_name[property.type].features |=3D Enum.FEATURE__D= ESERIALIZE features_have_changed =3D True elif property.is_object(): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 13:31:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625978; cv=none; d=zoho.com; s=zohoarc; b=NWgGW/OHslTK4HU4irwGpAL0wI628hm8AZfDPNjMRQRbcZYnD0bj8tnpNzIJLI136ZCgW5X4lt2FxM4lOVxrEEPcbvhXrxVJce+6SCNh/JhyNE9GjUhy81KqOaPB36eNu2znhMHMYHNJXFDn/VdyuuHbtifNVW7IdpSH1HCGkH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625978; h=Content-Type:Content-Transfer-Encoding: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=u+lDvx4dOT841OhHbDoLBtIxl5/fg8fnfEHXgHN/iI4=; b=jrWTB0fau14FMXcE3Nzi7fJ0N+YprUp4M6umhHqfb+GjdKG7QqQ/a/Zar4jPM0eoVa9pgouwoMCjawlq2uV6GLTVN7kJvWAY+OMHbk5xR3gCR60bQfBWCHj7fdhuCUPEC7A8o68K6hQ5RaWQKoOdU4INoeLDX99V4l1sIMJnI0U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570625978535346.74121563159053; Wed, 9 Oct 2019 05:59:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE96E9B282; Wed, 9 Oct 2019 12:59:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97EDF60BF4; Wed, 9 Oct 2019 12:59:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 51FB018037CD; Wed, 9 Oct 2019 12:59:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99CxYQI003139 for ; Wed, 9 Oct 2019 08:59:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id D89B35DA8D; Wed, 9 Oct 2019 12:59:34 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28EA65DA8C; Wed, 9 Oct 2019 12:59:23 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:44 +0100 Message-Id: <20191009125844.18202-11-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] build: comment on why we're not adopting certain flake8 rules X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 09 Oct 2019 12:59:37 +0000 (UTC) Simplify the list of ignored warnings now that we only have two left, and document why we're not honouring them. Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index ebacb8312e..812c8baae8 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -878,13 +878,17 @@ sc_require_enum_last_marker: { echo '$(ME): enum impl needs _LAST marker on second line' 1>&2; \ exit 1; } || : =20 -# Validate many python style rules -FLAKE8_LINE_LENGTH =3D E501 -FLAKE8_WARNINGS =3D W504 - -FLAKE8_IGNORE =3D $(FLAKE8_LINE_LENGTH),$\ - $(FLAKE8_WARNINGS) \ - $(NULL) +# We're intentionally ignoring a few warnings +# +# E501: Force breaking lines at < 80 characters results in +# some really unnatural code formatting which harms +# readability. +# +# W504: Knuth code style requires the operators "or" and "and" etc +# to be at the start of line in a multi-line conditional. +# This the opposite to what is normal libvirt practice. +# +FLAKE8_IGNORE =3D E501,W504 =20 sc_flake8: @if [ -n "$(FLAKE8)" ]; then \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list