From nobody Sat Feb 7 09:37:05 2026 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