From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296669902327.79275493261946; Sat, 17 Mar 2018 07:24:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3AF6019CBC4; Sat, 17 Mar 2018 14:24: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 93D0E5D6A5; Sat, 17 Mar 2018 14:24:27 +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 BBD91180613A; Sat, 17 Mar 2018 14:24:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENo0Y000464 for ; Sat, 17 Mar 2018 10:23:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 664115D70B; Sat, 17 Mar 2018 14:23:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CE575D6A5 for ; Sat, 17 Mar 2018 14:23:48 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C81FC80461 for ; Sat, 17 Mar 2018 14:23:46 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id z8so4581325wrh.7 for ; Sat, 17 Mar 2018 07:23:46 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tWU4BH8qAA5DYcZq5A5hvXPGoSVSqm/Qg9COMQQCeqY=; b=s3veeedaRgV1v+TZQA7beDh5D1Q2IVlF6kC9tUmlMx6GmF7fnlTSQsmhoL6ashjF6z +oq1cSjzsiGkSFZrXSnvCsKdvVe+cH0LY26QK+ThIlPb44Xi1ErvWBCjbDMrRYY7j5j8 VPJrIV1gOCimhyXjLqcOXl0zoM4mA2r+q4G4TwVHxTGPpzHGA5Bg+qwgoPRESUyXZcfp QOcR35J3gj+UhHvYbUT4qqT4PKlINWIw53LifFBr78f2DYdPNAGSt9nrQ13rnR1m1tO4 7go24ka2fiUT14OS1nNt70XIsTa9+MZDMCyKzio+/p3iX0i1Se1fKvWTAbaEGyCYGPxD zv8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tWU4BH8qAA5DYcZq5A5hvXPGoSVSqm/Qg9COMQQCeqY=; b=hTyGdbXC10aBUqyRgdIjwjEP4/ER9EkAEh9nLfSFWc5GNUH+1WLMiD9POBlp3Sykyy ow2QSLscRDhQMLAJFSV39nVSe1aPwKNsC4amL2bG8N0hqhODQ5u5rH1dIlpcTaeXSwzX ez36w/g23q6n14GoslMfc05I232S/E/xAeVFZnUbX/D5x/barW9ydweAGzLS+szAW8pA RhTkra48UAKQwuyMfDwT6uxLw4aodqczE/7G/nY+h0ntYnp+a4rO8uQfwMXEtm9jrhka /sQpN3dWewuWlwZyDK3b5ZKPxls4qphfN55dQ7Ibfcp1gsRQOYPOYWEpR+DXzbetlWFA I4rA== X-Gm-Message-State: AElRT7GNqLCI9lN/JvQPWCv2ICnKvAlxLC//ZITTC1GENG7zQXQK4dPC GKp0Ka1FIuKYfcwvaf7zJEqYyYDp X-Google-Smtp-Source: AG47ELsgRi/UR7dWHJryih/HnpZa5QLMxBbGZQ94xXqfyLPxYC6i2foHyu2DwuCPpXc4Oz5nQ51csw== X-Received: by 10.223.157.21 with SMTP id k21mr4859529wre.273.1521296625194; Sat, 17 Mar 2018 07:23:45 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:19 +0000 Message-Id: <20180317142340.11653-2-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:46 +0000 (UTC) for IP:'209.85.128.194' DOMAIN:'mail-wr0-f194.google.com' HELO:'mail-wr0-f194.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.194 mail-wr0-f194.google.com 209.85.128.194 mail-wr0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 01/22] apibuild: Use isinctance for type checking 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:28 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The isinstance() function [1] returns true if an object argument is an instance of a classinfo argument or of a direct, indirect subclass thereof. 1: https://docs.python.org/3/library/functions.html#isinstance Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 51abf8383..7faa083b2 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -742,7 +742,7 @@ class CParser: return line =20 def cleanupComment(self): - if type(self.comment) !=3D type(""): + if not isinstance(self.comment, str): return # remove the leading * on multi-line comments lines =3D self.comment.splitlines(True) @@ -2223,9 +2223,8 @@ class docBuilder: output.write(" \n") try: for field in self.idx.structs[name].info: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152129689021244.98209910278513; Sat, 17 Mar 2018 07:28:10 -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 F0AAC80F79; Sat, 17 Mar 2018 14:28:08 +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 C259C6A953; Sat, 17 Mar 2018 14:28:08 +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 8F8414CA99; Sat, 17 Mar 2018 14:28:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENqL1000478 for ; Sat, 17 Mar 2018 10:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB0F27EE14; Sat, 17 Mar 2018 14:23:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B424D7EE20 for ; Sat, 17 Mar 2018 14:23:49 +0000 (UTC) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8656C80C3F for ; Sat, 17 Mar 2018 14:23:48 +0000 (UTC) Received: by mail-wr0-f176.google.com with SMTP id h2so14250362wre.12 for ; Sat, 17 Mar 2018 07:23:48 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0AoTNK0wOC3zx6goc3Y3gZGyBp7wvd53WoqUdC2OFx0=; b=ZmqApq45GyHCFOMH2t2E5xwWGD9wJsFUOqZSn6vV5vg9fe5d79xeFy9ZVsHbQ39zcD uAKkG6DbB77u+buhihSq7IZ0rM3utrq3nWVwGKHxngdqaYLDPG/+B45OasVX3qOrxgdd RVDo+wX1K/7KSnSD7dfbRT7WfLKbtP92qujuAIpyr9lzWJcPy/aSQ+YOAWUoT7C/Vaoz YgrEAYo2iNp4yqaacdGEUM7RvpWij/7aaucDeM7aWT5fFe56FPc32VPox2P3+ATROsqu Xl/UhqP0OTpVqcXblHaxl1o7mpm6m1xqULPVjOMBomAZNA2iH+eVejM4woQwoFuJ9U8i b+NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0AoTNK0wOC3zx6goc3Y3gZGyBp7wvd53WoqUdC2OFx0=; b=YB9B2XwjskFUO5YF9bn0TjprCmpiA9in03Jr7z9UWILw86jVIKKLAR4z0DVHavttmi obLK9wY9Htqn7bRbw52GY1NQO7GGeRk7spiFXhw1tGkJQAqO7QnxJKzZso/KV1JBY6Xh EOr1hc12Iu7TqsezvFNBgwZh5rZZVrquBAgirW4NqUDfHEVpr11IraxkicXFp3JsPiyi 9zDpglS2qtaqtI1rmBi9xsi2ERQI6IsYY/F5JVMJXziXZhpRQPqUxBhfBhUyTp6BbmXR +OFyWOqThV+N0xXuFN9RWCTMoweIyIpf/GhBvYommk1NY4oSuzlVcwZBBvMhq/irI7jT FLuQ== X-Gm-Message-State: AElRT7GxPRnHGAgnKmvO+0lVl2/0yxzRE7k17f3x1+GotqySOhWImAsw NR3tz778ei7roErGVEo1Bqi0P//r X-Google-Smtp-Source: AG47ELsqdalkDtnrESGdQoy3ARJkD0xa7QksHpoCVJXYvIISN9FUvXJ/V3I2Nk4HPqDmwDduXwrB3Q== X-Received: by 10.223.150.111 with SMTP id c44mr4835378wra.90.1521296626924; Sat, 17 Mar 2018 07:23:46 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:20 +0000 Message-Id: <20180317142340.11653-3-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 17 Mar 2018 14:23:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 17 Mar 2018 14:23:48 +0000 (UTC) for IP:'209.85.128.176' DOMAIN:'mail-wr0-f176.google.com' HELO:'mail-wr0-f176.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.176 mail-wr0-f176.google.com 209.85.128.176 mail-wr0-f176.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 02/22] apibuild: Split imports on separate lines 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: , MIME-Version: 1.0 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.27]); Sat, 17 Mar 2018 14:28:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PEP8 recommends imports to be on separate lines. [1] 1: https://www.python.org/dev/peps/pep-0008/#imports Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 7faa083b2..190d5d93b 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -10,7 +10,8 @@ =20 from __future__ import print_function =20 -import os, sys +import os +import sys import glob import re =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296685477188.6506402101087; Sat, 17 Mar 2018 07:24:45 -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 D258933BF2; Sat, 17 Mar 2018 14:24:43 +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 9F52C7B55B; Sat, 17 Mar 2018 14:24:43 +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 68AAE181BA01; Sat, 17 Mar 2018 14:24:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENtRw000518 for ; Sat, 17 Mar 2018 10:23:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id A397080E81; Sat, 17 Mar 2018 14:23:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D48D80E97 for ; Sat, 17 Mar 2018 14:23:53 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1E7E3AD93 for ; Sat, 17 Mar 2018 14:23:50 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id l8so14303681wrg.5 for ; Sat, 17 Mar 2018 07:23:50 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IWJRzRj0+V29hbHJAG4tFmHkZvwxJkJLGCMjjTyEXO0=; b=NF9ywAZL3G27aqEhBFjSs6lfDPF0dKwhggTRD+H4Rq4xmv4NKLDSijsNjj2F1uYdS1 3+z8yQcdNdMjFxi+NcW7NH3bnXGL+scw04f4yWvoiu8Le3RK4MduLlFyV/K/DsB88YcF uzCHD97xOdsTmJ/8d6K4hJVGZN19b4v2YQivjyvjpvcZ7r5bSbbuil+zF9E4IthS81+J h0+4UyVvzZ7v0MWimSYAeXrd1orz7Cd1yTMHtYn/RW/CPdhXly4k/6ZrKo4dkE+Rdhyd wIpCmk8DdUZxvMMPsM3/vf7OAOo1m3Pwg3MNLlvOzeLDTiYByPT3k0ElAv+9lcxnlkh3 jtrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IWJRzRj0+V29hbHJAG4tFmHkZvwxJkJLGCMjjTyEXO0=; b=SUfv2vAk1DsdPdvfPLCjTCBkET1pxwd5AuLzrhnE73bSCOXIMzMYSfayVth0X1Hqmi I5uNxH0Co4fL0enqZHDCzvii1C6XubrbwCwFNsI0Cvoe0tRbBG/sZIq++v/trP5jIVnd h2WK9kls58INlPt/TUjBgycZmnSgZFh0cSBSMu866uEDVjAlZq6+4Fly2DDr+1s6jnOe tA5CB4zLKW5UxJJEZswKoxqsjKrbcHJUYk+/vb+nR9qUs8HOko8XRe+R7Xlw1r6c4u0E lrmKXW8zAWkTN5JGMt4+0Q/+Bekzci5HtLdIkHfL5vqGPGOcIKkyXv4qqDVi480tnAk8 bk7g== X-Gm-Message-State: AElRT7FakGWcnqibLvFtE3yXLzXzDq9awkfa38QUPi5a8em/3TxaG6j5 kMPRLGogFoHUDkCTix4EkSZD54eI X-Google-Smtp-Source: AG47ELulYghzLTG0veiAoOPRejg+XI69NT3uBLTpjxkQ8QRggxfyNQFGCZvpblY39vc7gH24DvuynA== X-Received: by 10.223.176.119 with SMTP id g52mr4667409wra.21.1521296628749; Sat, 17 Mar 2018 07:23:48 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:21 +0000 Message-Id: <20180317142340.11653-4-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:23:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:23:51 +0000 (UTC) for IP:'209.85.128.194' DOMAIN:'mail-wr0-f194.google.com' HELO:'mail-wr0-f194.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.194 mail-wr0-f194.google.com 209.85.128.194 mail-wr0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 03/22] apibuild: Remove whitespace before ', ' and ':' 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: , MIME-Version: 1.0 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.38]); Sat, 17 Mar 2018 14:24:44 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PEP8 recommends removing whitespace immediately before a comma, semicolon, or colon [1]. In addition remove multiple spaces after keyword (PEP8 - E271). 1: https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-= statements Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 102 +++++++++++++++++++--------------= ---- docs/index.py | 22 ++++---- src/esx/esx_vi_generator.py | 102 +++++++++++++++++----------------= ---- src/hyperv/hyperv_wmi_generator.py | 32 ++++++------ 4 files changed, 127 insertions(+), 131 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 190d5d93b..582c661e7 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -590,7 +590,7 @@ class CLexer: # 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 \ + 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', '...')) i =3D i + 3 @@ -1735,7 +1735,7 @@ class CParser: while token is not None and token[0] =3D=3D "op" and token[1] = =3D=3D '*': self.type =3D self.type + token[1] token =3D self.token() - if token is None or token[0] !=3D "name" : + if token is None or token[0] !=3D "name": self.error("parsing function type, name expected", token) return token self.type =3D self.type + token[1] @@ -1825,41 +1825,42 @@ class CParser: # this dict contains the functions that are allowed to use [unsigned] # long for legacy reasons in their signature and return type. this lis= t is # fixed. new procedures and public APIs have to use [unsigned] long lo= ng - long_legacy_functions =3D \ - { "virGetVersion" : (False, ("libVer", "typeVer")), - "virConnectGetLibVersion" : (False, ("libVer")), - "virConnectGetVersion" : (False, ("hvVer")), - "virDomainGetMaxMemory" : (True, ()), - "virDomainMigrate" : (False, ("flags", "bandwidth")), - "virDomainMigrate2" : (False, ("flags", "bandwidth")), - "virDomainMigrateBegin3" : (False, ("flags", "bandwidth")), - "virDomainMigrateConfirm3" : (False, ("flags", "bandwidth")), - "virDomainMigrateDirect" : (False, ("flags", "bandwidth")), - "virDomainMigrateFinish" : (False, ("flags")), - "virDomainMigrateFinish2" : (False, ("flags")), - "virDomainMigrateFinish3" : (False, ("flags")), - "virDomainMigratePeer2Peer" : (False, ("flags", "bandwidth")), - "virDomainMigratePerform" : (False, ("flags", "bandwidth")), - "virDomainMigratePerform3" : (False, ("flags", "bandwidth")), - "virDomainMigratePrepare" : (False, ("flags", "bandwidth")), - "virDomainMigratePrepare2" : (False, ("flags", "bandwidth")), - "virDomainMigratePrepare3" : (False, ("flags", "bandwidth")), - "virDomainMigratePrepareTunnel" : (False, ("flags", "bandwidth")), - "virDomainMigratePrepareTunnel3" : (False, ("flags", "bandwidth")), - "virDomainMigrateToURI" : (False, ("flags", "bandwidth")), - "virDomainMigrateToURI2" : (False, ("flags", "bandwidth")), - "virDomainMigrateVersion1" : (False, ("flags", "bandwidth")), - "virDomainMigrateVersion2" : (False, ("flags", "bandwidth")), - "virDomainMigrateVersion3" : (False, ("flags", "bandwidth")), - "virDomainMigrateSetMaxSpeed" : (False, ("bandwidth")), - "virDomainSetMaxMemory" : (False, ("memory")), - "virDomainSetMemory" : (False, ("memory")), - "virDomainSetMemoryFlags" : (False, ("memory")), - "virDomainBlockCommit" : (False, ("bandwidth")), - "virDomainBlockJobSetSpeed" : (False, ("bandwidth")), - "virDomainBlockPull" : (False, ("bandwidth")), - "virDomainBlockRebase" : (False, ("bandwidth")), - "virDomainMigrateGetMaxSpeed" : (False, ("bandwidth")) } + long_legacy_functions =3D { + "virGetVersion": (False, ("libVer", "typeVer")), + "virConnectGetLibVersion": (False, ("libVer")), + "virConnectGetVersion": (False, ("hvVer")), + "virDomainGetMaxMemory": (True, ()), + "virDomainMigrate": (False, ("flags", "bandwidth")), + "virDomainMigrate2": (False, ("flags", "bandwidth")), + "virDomainMigrateBegin3": (False, ("flags", "bandwidth")), + "virDomainMigrateConfirm3": (False, ("flags", "bandwidth")), + "virDomainMigrateDirect": (False, ("flags", "bandwidth")), + "virDomainMigrateFinish": (False, ("flags")), + "virDomainMigrateFinish2": (False, ("flags")), + "virDomainMigrateFinish3": (False, ("flags")), + "virDomainMigratePeer2Peer": (False, ("flags", "bandwidth")), + "virDomainMigratePerform": (False, ("flags", "bandwidth")), + "virDomainMigratePerform3": (False, ("flags", "bandwidth")), + "virDomainMigratePrepare": (False, ("flags", "bandwidth")), + "virDomainMigratePrepare2": (False, ("flags", "bandwidth")), + "virDomainMigratePrepare3": (False, ("flags", "bandwidth")), + "virDomainMigratePrepareTunnel": (False, ("flags", "bandwidth")), + "virDomainMigratePrepareTunnel3": (False, ("flags", "bandwidth")), + "virDomainMigrateToURI": (False, ("flags", "bandwidth")), + "virDomainMigrateToURI2": (False, ("flags", "bandwidth")), + "virDomainMigrateVersion1": (False, ("flags", "bandwidth")), + "virDomainMigrateVersion2": (False, ("flags", "bandwidth")), + "virDomainMigrateVersion3": (False, ("flags", "bandwidth")), + "virDomainMigrateSetMaxSpeed": (False, ("bandwidth")), + "virDomainSetMaxMemory": (False, ("memory")), + "virDomainSetMemory": (False, ("memory")), + "virDomainSetMemoryFlags": (False, ("memory")), + "virDomainBlockCommit": (False, ("bandwidth")), + "virDomainBlockJobSetSpeed": (False, ("bandwidth")), + "virDomainBlockPull": (False, ("bandwidth")), + "virDomainBlockRebase": (False, ("bandwidth")), + "virDomainMigrateGetMaxSpeed": (False, ("bandwidth")) + } =20 def checkLongLegacyFunction(self, name, return_type, signature): if "long" in return_type and "long long" not in return_type: @@ -1883,10 +1884,11 @@ class CParser: # this dict contains the structs that are allowed to use [unsigned] # long for legacy reasons. this list is fixed. new structs have to use # [unsigned] long long - long_legacy_struct_fields =3D \ - { "_virDomainInfo" : ("maxMem", "memory"), - "_virNodeInfo" : ("memory"), - "_virDomainBlockJobInfo" : ("bandwidth") } + long_legacy_struct_fields =3D { + "_virDomainInfo": ("maxMem", "memory"), + "_virNodeInfo": ("memory"), + "_virDomainBlockJobInfo": ("bandwidth") + } =20 def checkLongLegacyStruct(self, name, fields): for field in fields: @@ -1934,7 +1936,7 @@ class CParser: elif token[1] =3D=3D 'static': static =3D 1 token =3D self.token() - if token is None or token[0] !=3D 'name': + if token is None or token[0] !=3D 'name': return token =20 if token[1] =3D=3D 'typedef': @@ -2205,7 +2207,7 @@ class docBuilder: output.write(" \n") =20 def serialize_union(self, output, field, desc): - output.write(" = \n" % (field[1] , desc)) + output.write(" = \n" % (field[1], desc)) output.write(" \n") for f in field[3]: desc =3D f[2] @@ -2213,7 +2215,7 @@ class docBuilder: desc =3D '' else: desc =3D escape(desc) - output.write(" \n" % (f[1] , f[0], desc)) + output.write(" \n" % (f[1], f[0], desc)) =20 output.write(" \n") output.write(" \n") @@ -2238,13 +2240,13 @@ class docBuilder: if field[0] =3D=3D "union": self.serialize_union(output, field, desc) else: - output.write(" \n" % (field[1] , field[0], desc)) + output.write(" \n" % (field[1], field[0], desc)) except: self.warning("Failed to serialize struct %s" % (name)) output.write(" \n") else: output.write("/>\n") - else : + else: output.write(" \n" % (type)) ids =3D funcs[type] @@ -2430,7 +2432,7 @@ class docBuilder: typ =3D sorted(funcs.keys()) for type in typ: if type =3D=3D '' or type =3D=3D 'void' or type =3D=3D "int" o= r \ - type =3D=3D "char *" or type =3D=3D "const char *" : + type =3D=3D "char *" or type =3D=3D "const char *": continue output.write(" \n" % (type)) ids =3D sorted(funcs[type]) @@ -2589,7 +2591,7 @@ class app: builddir =3D os.path.abspath((os.environ["builddir"])) if srcdir =3D=3D builddir: builddir =3D None - if glob.glob(srcdir + "/../src/libvirt.c") !=3D [] : + if glob.glob(srcdir + "/../src/libvirt.c") !=3D []: if not quiet: print("Rebuilding API description for %s" % name) dirs =3D [srcdir + "/../src", @@ -2599,7 +2601,7 @@ class app: not os.path.exists(srcdir + "/../include/libvirt/libvirt-c= ommon.h")): dirs.append(builddir + "/../include/libvirt") builder =3D docBuilder(name, srcdir, dirs, []) - elif glob.glob("src/libvirt.c") !=3D [] : + elif glob.glob("src/libvirt.c") !=3D []: if not quiet: print("Rebuilding API description for %s" % name) builder =3D docBuilder(name, srcdir, diff --git a/docs/index.py b/docs/index.py index bedec8ae0..e2f9185c3 100755 --- a/docs/index.py +++ b/docs/index.py @@ -59,21 +59,21 @@ libxml2.registerErrorHandler(callback, None) # to create them # TABLES=3D{ - "symbols" : """CREATE TABLE symbols ( + "symbols": """CREATE TABLE symbols ( name varchar(255) BINARY NOT NULL, module varchar(255) BINARY NOT NULL, type varchar(25) NOT NULL, descr varchar(255), UNIQUE KEY name (name), KEY module (module))""", - "words" : """CREATE TABLE words ( + "words": """CREATE TABLE words ( name varchar(50) BINARY NOT NULL, symbol varchar(255) BINARY NOT NULL, relevance int, KEY name (name), KEY symbol (symbol), UNIQUE KEY ID (name, symbol))""", - "wordsHTML" : """CREATE TABLE wordsHTML ( + "wordsHTML": """CREATE TABLE wordsHTML ( name varchar(50) BINARY NOT NULL, resource varchar(255) BINARY NOT NULL, section varchar(255), @@ -82,30 +82,30 @@ TABLES=3D{ KEY name (name), KEY resource (resource), UNIQUE KEY ref (name, resource))""", - "wordsArchive" : """CREATE TABLE wordsArchive ( + "wordsArchive": """CREATE TABLE wordsArchive ( name varchar(50) BINARY NOT NULL, ID int(11) NOT NULL, relevance int, KEY name (name), UNIQUE KEY ref (name, ID))""", - "pages" : """CREATE TABLE pages ( + "pages": """CREATE TABLE pages ( resource varchar(255) BINARY NOT NULL, title varchar(255) BINARY NOT NULL, UNIQUE KEY name (resource))""", - "archives" : """CREATE TABLE archives ( + "archives": """CREATE TABLE archives ( ID int(11) NOT NULL auto_increment, resource varchar(255) BINARY NOT NULL, title varchar(255) BINARY NOT NULL, UNIQUE KEY id (ID,resource(255)), INDEX (ID), INDEX (resource))""", - "Queries" : """CREATE TABLE Queries ( + "Queries": """CREATE TABLE Queries ( ID int(11) NOT NULL auto_increment, Value varchar(50) NOT NULL, Count int(11) NOT NULL, UNIQUE KEY id (ID,Value(35)), INDEX (ID))""", - "AllQueries" : """CREATE TABLE AllQueries ( + "AllQueries": """CREATE TABLE AllQueries ( ID int(11) NOT NULL auto_increment, Value varchar(50) NOT NULL, Count int(11) NOT NULL, @@ -171,7 +171,7 @@ def checkTables(db, verbose =3D 1): if verbose: print "Table %s contains %d records" % (table, row[0]) except: - print "Troubles with table %s : repairing" % (table) + print "Troubles with table %s: repairing" % (table) ret =3D c.execute("repair table %s" % table) print "repairing returned %d" % (ret) ret =3D c.execute("SELECT count(*) from %s" % table) @@ -1041,7 +1041,7 @@ def analyzeHTMLPages(): doc =3D libxml2.htmlParseFile(html, None) try: res =3D analyzeHTML(doc, html) - print "Parsed %s : %d paragraphs" % (html, res) + print "Parsed %s: %d paragraphs" % (html, res) ret =3D ret + 1 except: print "could not parse %s" % (html) @@ -1230,7 +1230,7 @@ def main(): elif args[i] =3D=3D '--archive-year': i =3D i + 1 year =3D args[i] - months =3D ["January" , "February", "March", "April", "May= ", + months =3D ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] for month in months: diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 6ce017d79..8fbc8bef1 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1342,61 +1342,53 @@ predefined_objects =3D ["AnyType", "MethodFault", "ManagedObjectReference"] =20 -additional_enum_features =3D { "ManagedEntityStatus" : Enum.FEATURE__= ANY_TYPE, - "TaskInfoState" : Enum.FEATURE__AN= Y_TYPE, - "VirtualMachinePowerState" : Enum.FEATURE__AN= Y_TYPE } - -additional_object_features =3D { "AutoStartDefaults" : Object.FEA= TURE__ANY_TYPE, - "AutoStartPowerInfo" : Object.FEATU= RE__ANY_TYPE, - "DatastoreHostMount" : Object.FEATU= RE__DEEP_COPY | - Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "DatastoreInfo" : Object.FEATU= RE__ANY_TYPE | - Object.FEATU= RE__DYNAMIC_CAST, - "HostConfigManager" : Object.FEATU= RE__ANY_TYPE, - "HostCpuIdInfo" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "HostDatastoreBrowserSearchResults" : Objec= t.FEATURE__LIST | - Object.FEATU= RE__ANY_TYPE, - "HostHostBusAdapter" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "HostInternetScsiHba" : Object.FEATU= RE__DYNAMIC_CAST | - Object.FEATU= RE__DEEP_COPY, - "HostInternetScsiTargetTransport" : Object= .FEATURE__DYNAMIC_CAST, - "HostScsiDisk" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE | - Object.FEATU= RE__DYNAMIC_CAST, - "HostScsiTopologyInterface" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "HostScsiTopologyLun" : Object.FEATU= RE__ANY_TYPE | - Object.FEATU= RE__LIST | - Object.FEATU= RE__DEEP_COPY, - "HostScsiTopologyTarget" : Object.FEATU= RE__ANY_TYPE | - Object.FEATU= RE__LIST, - "HostPortGroup" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "HostVirtualSwitch" : Object.FEATU= RE__DEEP_COPY | - Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "ManagedObjectReference" : Object.FEATU= RE__ANY_TYPE, - "ObjectContent" : Object.FEATU= RE__DEEP_COPY, - "PhysicalNic" : Object.FEATU= RE__DEEP_COPY | - Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "ResourcePoolResourceUsage" : Object.FEATU= RE__ANY_TYPE, - "ScsiLun" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE | - Object.FEATU= RE__DEEP_COPY, - "ScsiLunDurableName" : Object.FEATU= RE__LIST, - "ServiceContent" : Object.FEATU= RE__DESERIALIZE, - "SharesInfo" : Object.FEATU= RE__ANY_TYPE, - "TaskInfo" : Object.FEATU= RE__LIST | - Object.FEATU= RE__ANY_TYPE, - "UserSession" : Object.FEATU= RE__ANY_TYPE, - "VirtualMachineQuestionInfo" : Object.FEATU= RE__ANY_TYPE, - "VirtualMachineSnapshotTree" : Object.FEATU= RE__DEEP_COPY | - Object.FEATU= RE__ANY_TYPE, - "VmEventArgument" : Object.FEATU= RE__DESERIALIZE } +additional_enum_features =3D { + "ManagedEntityStatus": Enum.FEATURE__ANY_TYPE, + "TaskInfoState": Enum.FEATURE__ANY_TYPE, + "VirtualMachinePowerState": Enum.FEATURE__ANY_TYPE +} + +additional_object_features =3D { + "AutoStartDefaults": Object.FEATURE__ANY_TYPE, + "AutoStartPowerInfo": Object.FEATURE__ANY_TYPE, + "DatastoreHostMount": (Object.FEATURE__DEEP_COPY | Object.FEATURE__LIS= T | + Object.FEATURE__ANY_TYPE), + "DatastoreInfo": Object.FEATURE__ANY_TYPE | Object.FEATURE__DYNAMIC_CA= ST, + "HostConfigManager": Object.FEATURE__ANY_TYPE, + "HostCpuIdInfo": Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE, + "HostDatastoreBrowserSearchResults": (Object.FEATURE__LIST | + Object.FEATURE__ANY_TYPE), + "HostHostBusAdapter": Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE, + "HostInternetScsiHba": (Object.FEATURE__DYNAMIC_CAST | + Object.FEATURE__DEEP_COPY), + "HostInternetScsiTargetTransport": Object.FEATURE__DYNAMIC_CAST, + "HostScsiDisk": (Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE | + Object.FEATURE__DYNAMIC_CAST), + "HostScsiTopologyInterface": (Object.FEATURE__LIST | + Object.FEATURE__ANY_TYPE), + "HostScsiTopologyLun": (Object.FEATURE__ANY_TYPE | Object.FEATURE__LIS= T | + Object.FEATURE__DEEP_COPY), + "HostScsiTopologyTarget": Object.FEATURE__ANY_TYPE | Object.FEATURE__L= IST, + "HostPortGroup": Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE, + "HostVirtualSwitch": (Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST= | + Object.FEATURE__ANY_TYPE), + "ManagedObjectReference": Object.FEATURE__ANY_TYPE, + "ObjectContent": Object.FEATURE__DEEP_COPY, + "PhysicalNic": (Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST | + Object.FEATURE__ANY_TYPE), + "ResourcePoolResourceUsage": Object.FEATURE__ANY_TYPE, + "ScsiLun": (Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE | + Object.FEATURE__DEEP_COPY), + "ScsiLunDurableName": Object.FEATURE__LIST, + "ServiceContent": Object.FEATURE__DESERIALIZE, + "SharesInfo": Object.FEATURE__ANY_TYPE, + "TaskInfo": Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE, + "UserSession": Object.FEATURE__ANY_TYPE, + "VirtualMachineQuestionInfo": Object.FEATURE__ANY_TYPE, + "VirtualMachineSnapshotTree": (Object.FEATURE__DEEP_COPY | + Object.FEATURE__ANY_TYPE), + "VmEventArgument": Object.FEATURE__DESERIALIZE +} =20 removed_object_features =3D {} =20 diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index d54810211..f98a77562 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -342,21 +342,23 @@ class WmiClassVersion: =20 =20 class Property: - typemap =3D {"boolean" : "BOOL", - "string" : "STR", - "datetime" : "STR", - "int8" : "INT8", - "sint8" : "INT8", - "int16" : "INT16", - "sint16" : "INT16", - "int32" : "INT32", - "sint32" : "INT32", - "int64" : "INT64", - "sint64" : "INT64", - "uint8" : "UINT8", - "uint16" : "UINT16", - "uint32" : "UINT32", - "uint64" : "UINT64"} + typemap =3D { + "boolean": "BOOL", + "string": "STR", + "datetime": "STR", + "int8": "INT8", + "sint8": "INT8", + "int16": "INT16", + "sint16": "INT16", + "int32": "INT32", + "sint32": "INT32", + "int64": "INT64", + "sint64": "INT64", + "uint8": "UINT8", + "uint16": "UINT16", + "uint32": "UINT32", + "uint64": "UINT64" + } =20 =20 def __init__(self, type, name, is_array): --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296728902518.9276052849757; Sat, 17 Mar 2018 07:25:28 -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 9AA5B80084; Sat, 17 Mar 2018 14:25:27 +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 6E4807EE25; Sat, 17 Mar 2018 14:25:27 +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 37746181B9FF; Sat, 17 Mar 2018 14:25:27 +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 w2HENqO7000483 for ; Sat, 17 Mar 2018 10:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id D4EAA76133; Sat, 17 Mar 2018 14:23:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CDF8B5DD82 for ; Sat, 17 Mar 2018 14:23:52 +0000 (UTC) Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1106C04AC45 for ; Sat, 17 Mar 2018 14:23:51 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id o8so14348734wra.1 for ; Sat, 17 Mar 2018 07:23:51 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YAKuq/JrAB8YUxZBFxfquMc5+uxKDeKM0K9xWtSMBqE=; b=MIc6iAw8Hd8VHd8nxjaDz+T6K4SQFTUJQpn07G8271SrRLaRmkFNJ8lmH4AMMTOlNP PUOsBf3haNYM+YaVRbpcrT3L1U/dtn5VG48y8/SRG4fRWU8dx7F4ICei5qwpTHxPCTX5 xMvIDeQg24p+jqfrBPSkwP6eI22tFHqGtPqMIakkS+YYrrG8bcN3Ixx9C/KR70kGC5un rtT6rYLeLfap+5QR3GIJYgmTNHW9v9FW8ioeEiuUWcS9ep0GXu4ZtsMOjW6RYohf8HmF EQ+rkrhwpOXMKKymwoz+uKlyIsfZuqW1mDNNbcFjIEkYuxPjKEj10mQPcTIbjtoCPmGj 0DmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YAKuq/JrAB8YUxZBFxfquMc5+uxKDeKM0K9xWtSMBqE=; b=dlWfnkXfZHggQ6lyZtc/NY7NYReFUrt/PReFeSsaBlrNOzv6M5GORcWgPDA1xGqeQ3 8J5ILOGg1x/RQKk1qomVZOVGDz9Hw6KDw7JkI8hh/olNqaYHsgwZqQCUamBBgspTuNs6 0rOQync9h/+XgQYR2HH4K2HlISXCYO/R1gzsYo55ZasnZe1SG6d9BFkj2FK2AGSphCBs iDGmfbMHX1/05EHDR+1OqvbcWS74naMlph0WnDYBb3+h6tIsAY466JGlQdzqgKHbFLwl boG+pv97QdJAHONzBNxF0/Blkov92xfYe21+tdjTeiJh8YQMLsogaontgc7eU0Wqj3kO 4G6A== X-Gm-Message-State: AElRT7Er1QjfNaDpUk543423ASvmdpuSUqLtgAXixTHC0ATgNoUAvQEf Qrgu05+LDSMBO36AGoPs6+PB1pQe X-Google-Smtp-Source: AG47ELtmYWnDFJFZmqDkBUtmIkm3Xszc5UnawhcF7NY1IRfEATMzhjJLv+k79Rm2FpIeZX7DvrwuZg== X-Received: by 10.223.160.182 with SMTP id m51mr1308596wrm.187.1521296630169; Sat, 17 Mar 2018 07:23:50 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:22 +0000 Message-Id: <20180317142340.11653-5-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:23:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:23:52 +0000 (UTC) for IP:'209.85.128.195' DOMAIN:'mail-wr0-f195.google.com' HELO:'mail-wr0-f195.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.195 mail-wr0-f195.google.com 209.85.128.195 mail-wr0-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 04/22] python: Add whitespace around = and % 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: , MIME-Version: 1.0 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.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:25:28 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 18 +++++++++--------- docs/index.py | 6 +++--- tests/cputestdata/cpu-cpuid.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 582c661e7..644d96f69 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -15,10 +15,10 @@ import sys import glob import re =20 -quiet=3DTrue -warnings=3D0 -debug=3DFalse -debugsym=3DNone +quiet =3D True +warnings =3D 0 +debug =3D False +debugsym =3D None =20 # # C parser analysis code @@ -132,7 +132,7 @@ def escape(raw): def uniq(items): d =3D {} for item in items: - d[item]=3D1 + d[item] =3D 1 k =3D sorted(d.keys()) return k =20 @@ -1408,7 +1408,7 @@ class CParser: value =3D "%d" % (int(value) + 1) except: self.warning("Failed to compute value of enum %s" = % (name)) - value=3D"" + value =3D "" if token[0] =3D=3D "sep" and token[1] =3D=3D ",": if commentsBeforeVal: self.cleanupComment() @@ -2286,7 +2286,7 @@ class docBuilder: if apstr !=3D "": apstr =3D apstr + " && " apstr =3D apstr + cond - output.write(" %s\n"% (apstr)) + output.write(" %s\n" % (apstr)) try: (ret, params, desc) =3D id.info output.write(" \n" % (desc)) @@ -2479,7 +2479,7 @@ class docBuilder: output.write(" \n") output.write(" \n") count =3D 0 - chunks.append(["chunk%s" % (chunk -1), first_lette= r, letter]) + chunks.append(["chunk%s" % (chunk - 1), first_lett= er, letter]) output.write(" \n" % (chunk= )) first_letter =3D id[0] chunk =3D chunk + 1 @@ -2502,7 +2502,7 @@ class docBuilder: output.write(" \n") output.write(" \n") if count !=3D 0: - chunks.append(["chunk%s" % (chunk -1), first_letter, lette= r]) + chunks.append(["chunk%s" % (chunk - 1), first_letter, lett= er]) output.write(" \n") for ch in chunks: output.write(" \n" % ( diff --git a/docs/index.py b/docs/index.py index e2f9185c3..5224324b1 100755 --- a/docs/index.py +++ b/docs/index.py @@ -58,7 +58,7 @@ libxml2.registerErrorHandler(callback, None) # The dictionary of tables required and the SQL command needed # to create them # -TABLES=3D{ +TABLES =3D { "symbols": """CREATE TABLE symbols ( name varchar(255) BINARY NOT NULL, module varchar(255) BINARY NOT NULL, @@ -116,8 +116,8 @@ TABLES=3D{ # # The XML API description file to parse # -API=3D"libvirt-api.xml" -DB=3DNone +API =3D "libvirt-api.xml" +DB =3D None =20 ######################################################################### # # diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index b74c3ce93..43c92731a 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -325,7 +325,7 @@ def formatCpuid(cpuid, path, comment): line =3D (" \n") - f.write(line %( + f.write(line % ( in_eax, in_ecx, leaf["eax"], leaf["ebx"], leaf["ecx"], leaf["edx"]= )) f.write("\n") --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296679664161.5604538709283; Sat, 17 Mar 2018 07:24:39 -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 0EF504E4C6; Sat, 17 Mar 2018 14:24:38 +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 D67A380E98; Sat, 17 Mar 2018 14:24:37 +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 9D3D04CA99; Sat, 17 Mar 2018 14:24:37 +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 w2HENs87000497 for ; Sat, 17 Mar 2018 10:23:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0EF935DD82; Sat, 17 Mar 2018 14:23:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08B4A7B547 for ; Sat, 17 Mar 2018 14:23:54 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBA6819CB85 for ; Sat, 17 Mar 2018 14:23:52 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id d10so14323631wrf.3 for ; Sat, 17 Mar 2018 07:23:52 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3YFNH8eibaUGi+B1QKHBloJCM7SD75pOXSYjAjgIZQE=; b=QZom4GyNTw8V6MwVORoOfnflSdGk7+jVVRf89tOYn7CGfMaxGw8oio/O1/JCCbcyrd tM/UXRAlS/yBv64R2zY3DxUayBYRLgqj1OueQJpxZPfZ2SncUlmL6BA50rYirmru0rdo j2C+W6nnPT2BXCITNs6kJU0zt6x7obMJvOv4iagTPsLuusk6IXsLm7EvRw1ibSiKQlFh gXzzm2EzhZg2guQxkZ9zHXXFvQLbmkRbmKcyVXaesyIfex6y8waW0M9zq7yRNilGICbj YssvapnESeGDv4Yh9mEOTqgk+qRkZ99WID5eHyUxGspTzbf02PK5OADrPRQjKSmNl+9q K+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3YFNH8eibaUGi+B1QKHBloJCM7SD75pOXSYjAjgIZQE=; b=C1/At3/4hAt5Dni2U+LGEFPQm+3iKX6A6rgLs1y1tyoYPow4UkdMACO0Gb9jmbiQUM 2q7r7nuX+EQWf36Ym6b8PxtfuhwNDxliW7oZPgwkZn+xH1wJCYBjjpLZOzOSXa4n0ZaK b+uB1MniKF3FTv3nmrN/NPSSvY97El7VBoj4xybWXe4JWIKMuSkyk1zYmCAjXXrqCDoI qkTfW1Szp310jH4X+skItyOqmYaRGeLYxDeRqOOjWq+j7gIV9b2QM/T5gKSNGJnHlVoE W/D+DrJiYlBwc67txl1BkeMH+3I5NPEsO6+9PCTl8IlP1kHT+T28XHVRTpAw5Mgpu3WQ muBQ== X-Gm-Message-State: AElRT7FSU26pFYz+urQyHI2XkqwO/m1SPusDQzmMNrD9FFEVRFpkktwt e/jq5GH6sLINFz83IZSo2pVx+rHg X-Google-Smtp-Source: AG47ELscAvzHONXohhks/RgH8/9+I8OeIAgzEa9d0JfnunCJMCt866Z8Ax6GdPfaqD1kqHCnnW47sQ== X-Received: by 10.223.132.167 with SMTP id 36mr4923050wrg.227.1521296631395; Sat, 17 Mar 2018 07:23:51 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:23 +0000 Message-Id: <20180317142340.11653-6-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:53 +0000 (UTC) for IP:'209.85.128.196' DOMAIN:'mail-wr0-f196.google.com' HELO:'mail-wr0-f196.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.196 mail-wr0-f196.google.com 209.85.128.196 mail-wr0-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 05/22] esx_vi_generator: Simplify generate_helper_source 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: , MIME-Version: 1.0 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.38]); Sat, 17 Mar 2018 14:24:38 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The generate_helper_source() function returns a formatted string. This could be achieved without the use of a local variable "source" and string concatenation. Signed-off-by: Radostin Stoyanov --- src/esx/esx_vi_generator.py | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 8fbc8bef1..19c225384 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1092,26 +1092,17 @@ class ManagedObject(GenericObject): =20 =20 def generate_helper_source(self): - source =3D "" - # lookup - source +=3D "/* esxVI_Lookup%s */\n" % self.name - source +=3D "ESX_VI__TEMPLATE__LOOKUP(%s,\n" % self.name - source +=3D "{\n" - - source +=3D self.generate_lookup_code1() - - source +=3D "},\n" - source +=3D "{\n" - - source +=3D self.generate_lookup_code2() - - source +=3D "})\n\n" - - source +=3D "\n\n" - - return source - + return ( + "/* esxVI_Lookup{name} */\n" + "ESX_VI__TEMPLATE__LOOKUP({name},\n" + "{{\n{lookup_code1}}},\n" + "{{\n{lookup_code2}}})\n\n\n\n" + ).format( + name=3Dself.name, + lookup_code1=3Dself.generate_lookup_code1(), + lookup_code2=3Dself.generate_lookup_code2() + ) =20 =20 class Enum(Type): --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296682618683.014045072962; Sat, 17 Mar 2018 07:24:42 -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 D478A80467; Sat, 17 Mar 2018 14:24:40 +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 A1CBB7BCB4; Sat, 17 Mar 2018 14:24:40 +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 57C56181B9FF; Sat, 17 Mar 2018 14:24:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENtrr000519 for ; Sat, 17 Mar 2018 10:23:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id A37FF77D48; Sat, 17 Mar 2018 14:23:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D4C880E98 for ; Sat, 17 Mar 2018 14:23:55 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FBD28553D for ; Sat, 17 Mar 2018 14:23:54 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id u46so283821wrc.11 for ; Sat, 17 Mar 2018 07:23:54 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gMbc5tBhhYsZnHTjwHNYZrrYvYoc2Wgp+pPsdg9d+JU=; b=Z83hTWvzwruqJZAKs7ZxWF8lhrKd0zBtiX5tfVZCuD8jtev/63M5FX/SnwtmOV/2cC qpUTqqiFzz8woEJ4QonFLYu8XIiyP68VybyE7HDTWZmZ9uPBu2J4VBLOL2DGR7oi1Jwq Wuu3PYMlba18s2NQBHZJZjgUYoZY818hG280RamHZUncnBWH19BQ8naVXsmtGqnF2EQj OuDgf62Cxti43m4a2qnGSl8avPD0rTwRkUNZUJJWslDcjozCA7f2pSsh3FE2QrGgKg9v GJiy0uI81v3KUZBCYir5az/BtIA/OWYxQJCQb6iFLlGHyNr33lFDTWq3cg8eRAxGBG8V +5Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gMbc5tBhhYsZnHTjwHNYZrrYvYoc2Wgp+pPsdg9d+JU=; b=Fhi9tc0DKiaTUzqeCFzuHb33yN1q1C7qH9oYHSEyQ0r0n+XQB+N4VV9ECNPL0la5uc 7W9aE6ueqQL2OVION6BFTnvDvH8RMu2UeJWYe+uqDqA6K779DBQo1XqBVBTf8R6G+eVb Q9BJZcvPLN8U1zMkhdKajlEdW9mpWFGW/LFQdAe/ysOjTveyczxsW0J7cah2a3IpVV3i jQibkZ1KZ7OI2wPkkAfKSpI9Xotxt3tMEiBnvpvO2B/ZQyYMdkgXBUhoPNydBUZ+BhhN X7ZaMyarncf962DbtFHw4BP+q2+vgHpoh1ZcODnU38LzxFvX87sqOf0W+hw+QD6P6hHH lPKg== X-Gm-Message-State: AElRT7H4kZ5RCYmYKQlmyTqXa5W7Bwl2Y4jVkASnpubPo9CQQPXOHKU6 Tzu8Sr6HMna6lCSI1jlPP4ivpWyb X-Google-Smtp-Source: AG47ELu5LzSBV4HJvV6eYdcz1ijmhw+49UdT9l7LH+zTsOJvMvmxIna2NQ7D0RKA/ZV9LjqJepo/xg== X-Received: by 10.223.208.202 with SMTP id z10mr1856664wrh.15.1521296632808; Sat, 17 Mar 2018 07:23:52 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:24 +0000 Message-Id: <20180317142340.11653-7-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:54 +0000 (UTC) for IP:'209.85.128.193' DOMAIN:'mail-wr0-f193.google.com' HELO:'mail-wr0-f193.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.193 mail-wr0-f193.google.com 209.85.128.193 mail-wr0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 06/22] esx_vi_generator: Simplify generate_helper_header 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: , MIME-Version: 1.0 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.28]); Sat, 17 Mar 2018 14:24:41 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function generate_helper_header() only returns a formatted string. This could be achieved without performing string concatenation. Signed-off-by: Radostin Stoyanov --- src/esx/esx_vi_generator.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 19c225384..1641a2a1e 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1021,20 +1021,15 @@ class ManagedObject(GenericObject): =20 =20 def generate_helper_header(self): - header =3D "" - # functions - header +=3D ("int esxVI_Lookup%s(esxVI_Context *ctx, " - "const char *name, " - "esxVI_ManagedObjectReference *root,= " - "esxVI_String *selectedPropertyNameL= ist, " - "esxVI_%s **item, " - "esxVI_Occurrence occurrence);\n") \ - % (self.name, self.name) - - header +=3D "\n" - - return header + return ( + "int esxVI_Lookup{name}(esxVI_Context *ctx, " + "const char *name, " + "esxVI_ManagedObjectReference *root, " + "esxVI_String *selectedPropertyNameList= , " + "esxVI_{name} **item, " + "esxVI_Occurrence occurrence);\n\n" + ).format(name=3Dself.name) =20 =20 def generate_source(self): --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296688074504.1252340750301; Sat, 17 Mar 2018 07:24:48 -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 B9FC02BBE08; Sat, 17 Mar 2018 14:24:46 +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 8B32C80F66; Sat, 17 Mar 2018 14:24:46 +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 52DCA180BAD7; Sat, 17 Mar 2018 14:24:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENuDJ000537 for ; Sat, 17 Mar 2018 10:23:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id C7DF75D70A; Sat, 17 Mar 2018 14:23:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C20FD5D6A5 for ; Sat, 17 Mar 2018 14:23:56 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B400719CB85 for ; Sat, 17 Mar 2018 14:23:55 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id 5so7955101wmh.0 for ; Sat, 17 Mar 2018 07:23:55 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rbJBpWPHdDPH4jUyNwSK8IpHIjrJgjYVUkvtvWoPiXo=; b=MPwjQ22gcBv2JhOBd/VbqgHtuI+tXruGsXZnbg9r7Fh0fIh5XRgqPFpGyQIVRnAKCj /lmlZ/XqqXoCb5D/cLBx+O35jPaLvGOxT+WCtpMO0MbCihnsx6w6W7v3eUR/u1auyZKF puBfoysctnS/+qsoTWwxqbEVcvR6hNLvRFQyhFhxGtFvomfXYQy9SmaVSMwsLmTviYb7 rfREYLZ/fBouJv13ZXjFZrEpVnpvDdoTruYmpZalu9tUyMHMsSm7oOxGZwVBSaU0XjvI gBi/yrwaNCCgaT6+VxzbHp1sW4QeAsk3hIfxM+tGplWuHKJTwOr15LHxuipJNHywyOC3 IErw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rbJBpWPHdDPH4jUyNwSK8IpHIjrJgjYVUkvtvWoPiXo=; b=csz2mdeeeThRQ2f7/4RtZZJMkNvWd/YNDRbGNWCDElCPRV6rjP+B84HKxkRODOH1IO qnT6HtPMDZMKCIcad9qwE3M2YCisnHCGOYXhOt0dhi+5pSuwn0urZRxGpDlUqn8+h/ZQ HFldwPiqaKnAWSFmBTDQJlki5+nmdnOvhn6DnxzspvjujsSWvOA8dZFe0+TqkU+xkN63 vKaJUlMyp8uQd5icodURmYTn1dlJsPXHukk71PX1rKnYITM5OmoJ1fu+NPa0W9PZeAQR C/eRSOIj0Z+xlKPgwbkWp/RVC0zblaYytBa2SXVboxjWGTcLN75BB82K0PDxQPbeMYbi lbzQ== X-Gm-Message-State: AElRT7H8nyvYG7u0oLELJQuQKmJI+z6EGKaHRdKZQYJJIppScPJO7/GN 72S/akCm5Hwe/wXWGYXazQOWlZmT X-Google-Smtp-Source: AG47ELsGknV++oNQBkgLxqkWxeKzPU9qBaftew1nOq+efLd+VaLBI3HCmQQd/rpmqtJdaHDmlyPlCw== X-Received: by 10.28.116.14 with SMTP id p14mr4677927wmc.117.1521296634120; Sat, 17 Mar 2018 07:23:54 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:25 +0000 Message-Id: <20180317142340.11653-8-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:55 +0000 (UTC) for IP:'74.125.82.68' DOMAIN:'mail-wm0-f68.google.com' HELO:'mail-wm0-f68.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.68 mail-wm0-f68.google.com 74.125.82.68 mail-wm0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 07/22] esx_vi_generator: Simplify get_occurrence_comment 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: , MIME-Version: 1.0 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]); Sat, 17 Mar 2018 14:24:47 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Reduce the number of if-statements and use a single return. Utilise a dictionary to map between occurrences and values. Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- src/esx/esx_vi_generator.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 1641a2a1e..e4890c61b 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -75,16 +75,16 @@ class Member: =20 =20 def get_occurrence_comment(self): - if self.occurrence =3D=3D OCCURRENCE__REQUIRED_ITEM: - return "/* required */" - elif self.occurrence =3D=3D OCCURRENCE__REQUIRED_LIST: - return "/* required, list */" - elif self.occurrence =3D=3D OCCURRENCE__OPTIONAL_ITEM: - return "/* optional */" - elif self.occurrence =3D=3D OCCURRENCE__OPTIONAL_LIST: - return "/* optional, list */" - - raise ValueError("unknown occurrence value '%s'" % self.occurrence) + occurrence_map =3D { + OCCURRENCE__REQUIRED_ITEM: "/* required */", + OCCURRENCE__REQUIRED_LIST: "/* required, list */", + OCCURRENCE__OPTIONAL_ITEM: "/* optional */", + OCCURRENCE__OPTIONAL_LIST: "/* optional, list */" + } + if self.occurrence not in occurrence_map: + raise ValueError("unknown occurrence value '%s'" % self.occurr= ence) + + return occurrence_map[self.occurrence] =20 =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296735925842.0822179689496; Sat, 17 Mar 2018 07:25:35 -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 7C2A97FDE1; Sat, 17 Mar 2018 14:25:34 +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 3A72380E99; Sat, 17 Mar 2018 14:25:34 +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 072624CA9A; Sat, 17 Mar 2018 14:25:34 +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 w2HENxmN000565 for ; Sat, 17 Mar 2018 10:23:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 845397B547; Sat, 17 Mar 2018 14:23:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DEB376133 for ; Sat, 17 Mar 2018 14:23:59 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 380F519CBB1 for ; Sat, 17 Mar 2018 14:23:57 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id z8so4581580wrh.7 for ; Sat, 17 Mar 2018 07:23:57 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EwpKUrTuphSh5nqxPFb4v7QuUHsNEuPTPp7iL19TvdM=; b=h+qZh8e9D/6wzLodOpnTH6N8XEaBRUXaSysdDb3KTdf6n6y2VMxwvagv7uRT+GR2lB tvCSCVmZXiD4sDvb8fx95xoYk6bJglhpk8q13ZRmiUZcQ3xdLYdR/gkC18ipzqqiQxjk nDKa2fVynzXziUZMKroFPaYZ+yU+7wxXYOZlS4YN79EVt2svl8YVMcWJ+MuD5++lXYqA iig8e3iQK4ttsgkoukGWyf6fXcCXtFN3xpdsZ8iEPGoRp7rxuXYRaXVaznvkpsODvkbX urBbjmcXYtpMDr6op1hl7dLbu5EjW/853EtS4KwXHTlf6wDGVOMElsL8TwaJX+/UZ/4c 5Xuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EwpKUrTuphSh5nqxPFb4v7QuUHsNEuPTPp7iL19TvdM=; b=i/SQpSGM8MYo7f2wYp9DHbc8k6kc+nw96NDjCrj/c+fE9W8Avh0pCFYIR8xTf/jdyr bttXXv8Etvq5NAYe/nU2MpOltpF7xz2AHjDzCCtbdtnPpR+JABLtA0Lg5wO73LDmGR8D o3GrsKkte1wodf9WiG0mIfmaBHto8fyQM17byTm9TpvGDq4sl3B/8CP8VcwdT+z89EHg WhYUKUFmZH8CcIVN0M2YfBzfBIQ+GO4JkTgz1ZLYaEtmd85ImA78o0OLUDFYUCWbZZwI Oq5kAZnLt+0fV40U5w50mqWRBXyKDQfmJamsw5KUWX7J2dS4JsnqMwf6TnxYYQqmkDh0 Ih6g== X-Gm-Message-State: AElRT7FVXdpGoLlwnjxwhyp79I+G30q5lkgUBHYuUKq5uFuPv5YPijxV l2cNC6dQGLOP2xUt5ZPxsNfX5wjM X-Google-Smtp-Source: AG47ELtove7dAsK38SJelJoWPSJA08eQb0gY7yu9GPdM+uDKqOq3tRajFz0cSBSTgTVzN0PLyvvgJA== X-Received: by 10.223.182.174 with SMTP id j46mr4813354wre.43.1521296635630; Sat, 17 Mar 2018 07:23:55 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:26 +0000 Message-Id: <20180317142340.11653-9-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:23:57 +0000 (UTC) for IP:'209.85.128.194' DOMAIN:'mail-wr0-f194.google.com' HELO:'mail-wr0-f194.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.194 mail-wr0-f194.google.com 209.85.128.194 mail-wr0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 08/22] esx_vi_generator: Simplify alignment function 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: , MIME-Version: 1.0 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.27]); Sat, 17 Mar 2018 14:25:35 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Generate whitespace using the standard function ljust() that is available in both Py3 [1] and Py2 [2]. 1: https://docs.python.org/3/library/stdtypes.html?highlight=3Dstrip#str.lj= ust 2: https://docs.python.org/2.7/library/string.html#string.ljust Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- src/esx/esx_vi_generator.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index e4890c61b..0dca44fed 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -49,10 +49,7 @@ separator =3D "/* " + ("* " * 37) + "*\n" =20 =20 def aligned(left, right, length=3D59): - while len(left) < length: - left +=3D " " - - return left + right + return left.ljust(length, ' ') + right =20 =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296738826319.92108446329166; Sat, 17 Mar 2018 07:25:38 -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 982DC369BD; Sat, 17 Mar 2018 14:25:37 +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 7105A76133; Sat, 17 Mar 2018 14:25:37 +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 359C2181B9FF; Sat, 17 Mar 2018 14:25:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HENxrg000573 for ; Sat, 17 Mar 2018 10:23:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id B832680E81; Sat, 17 Mar 2018 14:23:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B179F77D48 for ; Sat, 17 Mar 2018 14:23:59 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 895BE8553D for ; Sat, 17 Mar 2018 14:23:58 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 139so7948615wmn.2 for ; Sat, 17 Mar 2018 07:23:58 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jh3O4appKj66LTBY0YWUftThqzDB8TeI7kvUIQH3mGs=; b=f2qT39P8UF6qXqFUz7BjYtSl8sFhYh2RPpvbEhqwTy22alO2yWwAYvz0gnIy3C93fJ CBZuLO6IeQuBt76MBUX/nzhR22/uPrjyczLVR2D5AZe7DI3YIDuamDvb7MwFGL7y7xoW IR/FMnc/V/ThYIIs0/aZFtrSa7Ac+jvSizxLTJrH02gG7ky6aIZGqidqPHNGirakIf+k NeofKwgd/mM0kEv2Hv7mNJDNWzoFtXLNdDpU4eImClywXwKorvbW43ZgenblvmsAteL9 XwNq483mXifCYx/+oygOo2Q4/LSxs35hQ/Nadunba1bZQ9YNj94yG2gcNSEywg17iU5c VAdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jh3O4appKj66LTBY0YWUftThqzDB8TeI7kvUIQH3mGs=; b=VyavP9ATGx5fOb4Qu9Gj78FiQxc5GwI9WvPup3bm7P3Nfc38WMjne2yStcwV7Q9x6Q vcHp7POE492kcR9suWA85swhu3LdHWjEDcROcBKyZM4+kWzpRVIj2m6T9XQC030izezA aqbfLHf1gYayiOn6ehKus9Mxim32GaN+huaVRXNs+uIkENA/Lx8PVR9GWcdRrawBu7VB AyXvmf9NIOdPVzOC7ACQguIn0vmdXrKtz4L299yQ3RrSms6IQ257YgCgtbqwAMJt5Q2+ 97QWTtGq11HDIF9PdTU/3n7yQVpaOGQ5KuZSiU5taRsaD28TzXmh/dFPOIr8VbnfnquT tuEw== X-Gm-Message-State: AElRT7H5VGuK9Gp847HXfmIiv1jHZvXOmBkQK4x+DpEgoFxK5Hxcarph hfKtCm+husd5W1z0FRqHy7AR8Dag X-Google-Smtp-Source: AG47ELuhvW7IOO01yXzioievXpy4ujC/VxLiMBjAzeAeiNho2uqfTyfbgj0NZXjF3j85sfjxKkC2+g== X-Received: by 10.28.52.9 with SMTP id b9mr4739307wma.134.1521296636894; Sat, 17 Mar 2018 07:23:56 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:27 +0000 Message-Id: <20180317142340.11653-10-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:23:58 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 09/22] apibuild: Simplify conditional statements 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: , MIME-Version: 1.0 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.30]); Sat, 17 Mar 2018 14:25:38 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Improve readability by reducing the complexity and length of conditional statements. Example: The following condition: if (o >=3D 97 and o <=3D 122) or (o >=3D 65 and o <=3D 90) or (o >=3D 48 and o <=3D 57) or (" \t(){}:;,+-*/%&!|[]=3D><".find(line[i]) =3D=3D -1): Will be True for every character that is not in string: " \t(){}:;,+-*/%&!|[]=3D><" Signed-off-by: Radostin Stoyanov --- docs/apibuild.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 644d96f69..1b9401226 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -564,28 +564,23 @@ class CLexer: if line[i] =3D=3D ' ' or line[i] =3D=3D '\t': i =3D i + 1 continue - o =3D ord(line[i]) - if (o >=3D 97 and o <=3D 122) or (o >=3D 65 and o <=3D 90)= or \ - (o >=3D 48 and o <=3D 57): + if re.match(r"[a-zA-Z0-9]", line[i]): s =3D i while i < l: - o =3D ord(line[i]) - if (o >=3D 97 and o <=3D 122) or (o >=3D 65 and o = <=3D 90) or \ - (o >=3D 48 and o <=3D 57) or \ - (" \t(){}:;,+-*/%&!|[]=3D><".find(line[i]) =3D= =3D -1): + if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": i =3D i + 1 else: break self.tokens.append(('name', line[s:i])) continue - if "(){}:;,[]".find(line[i]) !=3D -1: + 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 "+-*><=3D/%&!|.".find(line[i]) !=3D -1: + 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 \ @@ -597,8 +592,7 @@ class CLexer: continue =20 j =3D i + 1 - if j < l and ( - "+-*><=3D/%&!|".find(line[j]) !=3D -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 \ @@ -611,10 +605,7 @@ class CLexer: continue s =3D i while i < l: - o =3D ord(line[i]) - if (o >=3D 97 and o <=3D 122) or (o >=3D 65 and o <=3D= 90) or \ - (o >=3D 48 and o <=3D 57) or \ - (" \t(){}:;,+-*/%&!|[]=3D><".find(line[i]) =3D=3D -= 1): + 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 @@ -1555,10 +1546,8 @@ class CParser: if token is None: return token =20 - while token[0] =3D=3D "name" and ( - token[1] =3D=3D "const" or \ - token[1] =3D=3D "unsigned" or \ - token[1] =3D=3D "signed"): + while (token[0] =3D=3D "name" and + token[1] in ["const", "unsigned", "signed"]): if self.type =3D=3D "": self.type =3D token[1] else: @@ -2402,8 +2391,7 @@ class docBuilder: pass typ =3D sorted(funcs.keys()) for type in typ: - if type =3D=3D '' or type =3D=3D 'void' or type =3D=3D "int" o= r \ - type =3D=3D "char *" or type =3D=3D "const char *": + if type in ['', "void", "int", "char *", "const char *"]: continue output.write(" \n" % (type)) ids =3D funcs[type] @@ -2431,8 +2419,7 @@ class docBuilder: pass typ =3D sorted(funcs.keys()) for type in typ: - if type =3D=3D '' or type =3D=3D 'void' or type =3D=3D "int" o= r \ - type =3D=3D "char *" or type =3D=3D "const char *": + if type in ['', "void", "int", "char *", "const char *"]: continue output.write(" \n" % (type)) ids =3D sorted(funcs[type]) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296898834207.80849886418298; Sat, 17 Mar 2018 07:28:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65231C04C28A; Sat, 17 Mar 2018 14:28:17 +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 4302E620BF; Sat, 17 Mar 2018 14:28: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 0F32B4CAA1; Sat, 17 Mar 2018 14:28:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOALq000666 for ; Sat, 17 Mar 2018 10:24:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3C047EE22; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD6AB7EE20 for ; Sat, 17 Mar 2018 14:24:07 +0000 (UTC) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C48B7FEB0 for ; Sat, 17 Mar 2018 14:24:00 +0000 (UTC) Received: by mail-wm0-f44.google.com with SMTP id h76so7979827wme.4 for ; Sat, 17 Mar 2018 07:24:00 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=usPrnNBSOyojfNjubI1q7rJcAVy1YFH7pswsJzt5LDI=; b=vgnlgIzz62KerWFA/PMFzAUdwUb2Yeu3E5XC+hyOx0/lCWsAQ0LGC8P2E31r30x9Vl uImXyZ0b0cGEaLmDf5+LLML793nnThTMfxBALyQL0I6ojxgxYWVeuZ9YS5VTgn5xSgJo US5TrNyNWQv7BGSG4jeegqIHzbT74j8/Vy8ZvPFfTOnXuphd08HBUTZ9RF8wCH4soKjb ZiY9PzgO2j5slrMvlCHYGA6IxRdEHBDjaQ13xQwYxerpRe/a8Cjg9YXpL2d/oMH5OuiJ Te6kGkBPd6Ey3wWBwpx33gajjoRNu6v8E2jZ09XIsa7JXgqaSoeLqQ0CAhWdpPnN4XKw LyUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=usPrnNBSOyojfNjubI1q7rJcAVy1YFH7pswsJzt5LDI=; b=cfobQSgXOQou4n+lH4Eo80XJZfyQD1xd3vaLHJ5f3lRYhrrqHbhX+rP9nFaEeIshCh +wLxeab2VpGxst/nYQsovwpO7/fyCO3URSQUzjFIHZTLuOUdnJqLBs67t3Plz2/ppYBE uku7DXlxuY60xD59GkLWAkbuoLVkWUiHiLH+Xuc9KYq7lwWj9qkvrw8f6BajNxnvodqP P26+hpCBSrDjARZLNTcBtW16LIVo4AT7gw9Z3R0L1qAfA3Ovb2yw6WVBxQGYG8QUQO/Y ElG4dWuyMRuQS4T7lQHAyZzvLALB5rDJKCAdJk57pwwNRvnXOqCBTsIunqNV36VcpDZx aR2g== X-Gm-Message-State: AElRT7FUUiyPjb7u9iEVOXnQVbcZXfgnc1u4m9IHVncanKu7o6mT5wVq Hdj/Ky/A9OTm7otN0cYHJrsjQO4r X-Google-Smtp-Source: AG47ELveL6Cz4czfPyQqRdrTUS06WPcdvRaKpJU+mToa44IhfMNy+My7ifUILlynF8D3g4tNmF18kw== X-Received: by 10.28.88.211 with SMTP id m202mr4784510wmb.160.1521296638554; Sat, 17 Mar 2018 07:23:58 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:28 +0000 Message-Id: <20180317142340.11653-11-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Mar 2018 14:24:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Mar 2018 14:24:00 +0000 (UTC) for IP:'74.125.82.44' DOMAIN:'mail-wm0-f44.google.com' HELO:'mail-wm0-f44.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.44 mail-wm0-f44.google.com 74.125.82.44 mail-wm0-f44.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 10/22] python: Remove space around = in keyword args 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 17 Mar 2018 14:28:17 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PEP8 recommends not having spaces around =3D in a keyword argument or a default parameter value. https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 24 ++++++++++++------------ docs/index.py | 26 +++++++++++++------------- src/esx/esx_vi_generator.py | 4 ++-- tests/cputestdata/cpu-cpuid.py | 4 ++-- tests/cputestdata/cpu-reformat.py | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 1b9401226..8fecf5a81 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -137,8 +137,8 @@ def uniq(items): return k =20 class identifier: - def __init__(self, name, header=3DNone, module=3DNone, type=3DNone, li= neno =3D 0, - info=3DNone, extra=3DNone, conditionals =3D None): + def __init__(self, name, header=3DNone, module=3DNone, type=3DNone, li= neno=3D0, + info=3DNone, extra=3DNone, conditionals=3DNone): self.name =3D name self.header =3D header self.module =3D module @@ -209,7 +209,7 @@ class identifier: def get_conditionals(self): return self.conditionals =20 - def update(self, header, module, type =3D None, info =3D None, extra= =3DNone, + def update(self, header, module, type=3DNone, info=3DNone, extra=3DNon= e, conditionals=3DNone): if self.name =3D=3D debugsym and not quiet: print("=3D> update %s : %s" % (debugsym, (module, type, info, @@ -228,7 +228,7 @@ class identifier: self.set_conditionals(conditionals) =20 class index: - def __init__(self, name =3D "noname"): + def __init__(self, name=3D"noname"): self.name =3D name self.identifiers =3D {} self.functions =3D {} @@ -247,7 +247,7 @@ class index: warnings =3D warnings + 1 print(msg) =20 - def add_ref(self, name, header, module, static, type, lineno, info=3DN= one, extra=3DNone, conditionals =3D None): + def add_ref(self, name, header, module, static, type, lineno, info=3DN= one, extra=3DNone, conditionals=3DNone): if name[0:2] =3D=3D '__': return None d =3D None @@ -269,7 +269,7 @@ class index: =20 return d =20 - def add(self, name, header, module, static, type, lineno, info=3DNone,= extra=3DNone, conditionals =3D None): + def add(self, name, header, module, static, type, lineno, info=3DNone,= extra=3DNone, conditionals=3DNone): if name[0:2] =3D=3D '__': return None d =3D None @@ -630,7 +630,7 @@ class CLexer: =20 class CParser: """The C module parser""" - def __init__(self, filename, idx =3D None): + def __init__(self, filename, idx=3DNone): self.filename =3D filename if len(filename) > 2 and filename[-2:] =3D=3D '.h': self.is_header =3D 1 @@ -662,7 +662,7 @@ class CParser: def lineno(self): return self.lexer.getlineno() =20 - def index_add(self, name, module, static, type, info=3DNone, extra =3D= None): + def index_add(self, name, module, static, type, info=3DNone, extra=3DN= one): if self.is_header =3D=3D 1: self.index.add(name, module, module, static, type, self.lineno= (), info, extra, self.conditionals) @@ -671,7 +671,7 @@ class CParser: info, extra, self.conditionals) =20 def index_add_ref(self, name, module, static, type, info=3DNone, - extra =3D None): + extra=3DNone): if self.is_header =3D=3D 1: self.index.add_ref(name, module, module, static, type, self.lineno(), info, extra, self.conditiona= ls) @@ -764,7 +764,7 @@ class CParser: # # Parse a comment block associate to a typedef # - def parseTypeComment(self, name, quiet =3D 0): + def parseTypeComment(self, name, quiet=3D0): if name[0:2] =3D=3D '__': quiet =3D 1 =20 @@ -809,7 +809,7 @@ class CParser: # # Parse a comment block associate to a macro # - def parseMacroComment(self, name, quiet =3D 0): + def parseMacroComment(self, name, quiet=3D0): global ignored_macros =20 if name[0:2] =3D=3D '__': @@ -886,7 +886,7 @@ class CParser: # parameters descriptions, finally returns a block as complete # as possible # - def mergeFunctionComment(self, name, description, quiet =3D 0): + def mergeFunctionComment(self, name, description, quiet=3D0): global ignored_functions =20 if name =3D=3D 'main': diff --git a/docs/index.py b/docs/index.py index 5224324b1..0d07ca4d0 100755 --- a/docs/index.py +++ b/docs/index.py @@ -144,7 +144,7 @@ def createTable(db, name): return -1 return ret =20 -def checkTables(db, verbose =3D 1): +def checkTables(db, verbose=3D1): global TABLES =20 if db is None: @@ -188,7 +188,7 @@ def checkTables(db, verbose =3D 1): pass return 0 =20 -def openMySQL(db=3D"libvir", passwd=3DNone, verbose =3D 1): +def openMySQL(db=3D"libvir", passwd=3DNone, verbose=3D1): global DB =20 if passwd is None: @@ -275,25 +275,25 @@ def updateSymbol(name, module, type, desc): =20 return ret =20 -def addFunction(name, module, desc =3D ""): +def addFunction(name, module, desc=3D""): return updateSymbol(name, module, 'function', desc) =20 -def addMacro(name, module, desc =3D ""): +def addMacro(name, module, desc=3D""): return updateSymbol(name, module, 'macro', desc) =20 -def addEnum(name, module, desc =3D ""): +def addEnum(name, module, desc=3D""): return updateSymbol(name, module, 'enum', desc) =20 -def addStruct(name, module, desc =3D ""): +def addStruct(name, module, desc=3D""): return updateSymbol(name, module, 'struct', desc) =20 -def addConst(name, module, desc =3D ""): +def addConst(name, module, desc=3D""): return updateSymbol(name, module, 'const', desc) =20 -def addType(name, module, desc =3D ""): +def addType(name, module, desc=3D""): return updateSymbol(name, module, 'type', desc) =20 -def addFunctype(name, module, desc =3D ""): +def addFunctype(name, module, desc=3D""): return updateSymbol(name, module, 'functype', desc) =20 def addPage(resource, title): @@ -1055,7 +1055,7 @@ def analyzeHTMLPages(): =20 import time =20 -def getXMLDateArchive(t =3D None): +def getXMLDateArchive(t=3DNone): if t is None: t =3D time.time() T =3D time.gmtime(t) @@ -1064,7 +1064,7 @@ def getXMLDateArchive(t =3D None): url =3D "http://www.redhat.com/archives/libvir-list/%d-%s/date.html" %= (year, month) return url =20 -def scanXMLMsgArchive(url, title, force =3D 0): +def scanXMLMsgArchive(url, title, force=3D0): if url is None or title is None: return 0 =20 @@ -1094,7 +1094,7 @@ def scanXMLMsgArchive(url, title, force =3D 0): =20 return 1 =20 -def scanXMLDateArchive(t =3D None, force =3D 0): +def scanXMLDateArchive(t=3DNone, force=3D0): global wordsDictArchive =20 wordsDictArchive =3D {} @@ -1138,7 +1138,7 @@ def scanXMLDateArchive(t =3D None, force =3D 0): # Main code: open the DB, the API XML and analyze it # # # ######################################################################### -def analyzeArchives(t =3D None, force =3D 0): +def analyzeArchives(t=3DNone, force=3D0): global wordsDictArchive =20 ret =3D scanXMLDateArchive(t, force) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 0dca44fed..1e61cc71e 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -118,7 +118,7 @@ class Parameter(Member): return aligned(string, self.get_occurrence_comment() + "\n") =20 =20 - def generate_return(self, offset =3D 0, end_of_line =3D ";"): + 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'" % self.occurrence) @@ -609,7 +609,7 @@ class Object(GenericObject): return source =20 =20 - def generate_deep_copy_code(self, add_banner =3D False): + def generate_deep_copy_code(self, add_banner=3DFalse): source =3D "" =20 if self.extends is not None: diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 43c92731a..c45118512 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -343,12 +343,12 @@ def convert(path): with open(path, "w") as f: json.dump({"return": {"model": {"name": "base", "props": props}}, "id": "model-expansion"}, - f, indent =3D 2, separators =3D (',', ': ')) + f, indent=3D2, separators=3D(',', ': ')) f.write("\n") =20 for chunk in rest: f.write("\n") - json.dump(chunk, f, indent =3D 2, separators =3D (',', ': ')) + json.dump(chunk, f, indent=3D2, separators=3D(',', ': ')) f.write("\n") =20 =20 diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-refo= rmat.py index 999ef1698..33976e775 100755 --- a/tests/cputestdata/cpu-reformat.py +++ b/tests/cputestdata/cpu-reformat.py @@ -5,5 +5,5 @@ import json =20 dec =3D json.JSONDecoder() data, pos =3D dec.raw_decode(sys.stdin.read()) -json.dump(data, sys.stdout, indent =3D 2, separators =3D (',', ': ')) +json.dump(data, sys.stdout, indent=3D2, separators=3D(',', ': ')) print --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296742400224.42969448437748; Sat, 17 Mar 2018 07:25:42 -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 0674B85359; Sat, 17 Mar 2018 14:25:41 +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 C10C97EE2E; Sat, 17 Mar 2018 14:25:40 +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 833D24CA9E; Sat, 17 Mar 2018 14:25:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO2BQ000592 for ; Sat, 17 Mar 2018 10:24:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E56077D48; Sat, 17 Mar 2018 14:24:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 063BA80E97 for ; Sat, 17 Mar 2018 14:24:02 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 540E1C047B65 for ; Sat, 17 Mar 2018 14:24:01 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id q83so7978542wme.5 for ; Sat, 17 Mar 2018 07:24:01 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p2xYohaYySNV35tkP6K+PasiPFHThmzLn7qGfW5m5UA=; b=I6qcrwEK+xl5N+A7KnxTv/Uyv+hAhQvYoWXYMt9X8Tl2Yb5sJcG+1rekrYA7FVnNnM M5x+SzcVt+h2xClEJWZriqCsBSpJ27GbfCT8Z6YAnAlKPLSG7BxoeuybU9ORux6Bf6Qm rQ1IoRko43R+HUygFAnfIj9cvub529e5tNy11UOiNxVSxbQCwlrb0vdUSaejf9r0af5p 9mHjTW1fM1cOfAYjQESWablrHnBujvV0apGw0U3QabH+m/iT1N7Ge7nCOZ1sqneeWxN1 Ztcy1v/ac9jNHDQ4BUrgUkT7QRvIrpw8sQThc3uFiXnkazKGjxNBrfosoUUgf3MjY8cG IKag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p2xYohaYySNV35tkP6K+PasiPFHThmzLn7qGfW5m5UA=; b=YJGyq8Je7NH1vPXHPYiQM0wIYE7Opq4c4FO/1ZTInp9nsW5mOMspUxLrUnwL/BnXOT BZ3yBeKXtxkRKWvw0DNEGEDHipyBnB9VHE8wtNIy4mBdYRwoZZWLkK9Xp2X6aY15MJZx yIRG8pSLL6TOYjrAtcgBuFB6y0TnWtqvbU1+gCmU01Qf3RYCdti4sPpJfl8WevZvvt1h 5CgAn6zvh5UqpBQHXuOlWS6LH5Gspptshkdk3KBZjr93jouFWysXcOEMpY7kNK0lb/DO ENbVf3vH1oWcspJpbd5vfU+PrK+eFW88+X0aiqOiqZzH466PZbi53XeQNC1SI2G9snEZ gtJw== X-Gm-Message-State: AElRT7GC8Ent7qJdkbNcXcJszkH+vpRZms0pJOrCzPzrmXCyvn8Nn1VS PzG1FMpNUOR/3qWnYB2jU3HCLU6S X-Google-Smtp-Source: AG47ELsyxiv9AOvobJJ1oCM9dD6ypJsEMj5Xvsixfnk2OGdRSuKpDU+stEhl+oREjSf8wESKUgamjw== X-Received: by 10.28.181.16 with SMTP id e16mr2341008wmf.97.1521296639736; Sat, 17 Mar 2018 07:23:59 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:29 +0000 Message-Id: <20180317142340.11653-12-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:24:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:24:01 +0000 (UTC) for IP:'74.125.82.68' DOMAIN:'mail-wm0-f68.google.com' HELO:'mail-wm0-f68.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.68 mail-wm0-f68.google.com 74.125.82.68 mail-wm0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 11/22] WmiClass: Don't share "versions" between instances 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: , MIME-Version: 1.0 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.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Mar 2018 14:25:41 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Lists in Python are mutable and when used as a default value of a parameter for class constructor, its value will be shared between all class instances. Example: class Test: def __init__(self, mylist=3D[]): self.mylist =3D mylist A =3D Test() B =3D Test() A.mylist.append("mylist from instance A") print(B.mylist) # Will print ['mylist from instance A'] Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- src/hyperv/hyperv_wmi_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index f98a77562..acb9e5440 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -44,9 +44,9 @@ class WmiClass: to. """ =20 - def __init__(self, name, versions =3D []): + def __init__(self, name, versions=3DNone): self.name =3D name - self.versions =3D versions + self.versions =3D versions if versions else list() self.common =3D None =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296745150392.7280670663298; Sat, 17 Mar 2018 07:25:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0E9168115; Sat, 17 Mar 2018 14:25:43 +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 B68AA5D75E; Sat, 17 Mar 2018 14:25:43 +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 781A54CAA1; Sat, 17 Mar 2018 14:25:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO3JD000605 for ; Sat, 17 Mar 2018 10:24:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC18E7EE14; Sat, 17 Mar 2018 14:24:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C14B87EE20 for ; Sat, 17 Mar 2018 14:24:03 +0000 (UTC) Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E1B319CBC4 for ; Sat, 17 Mar 2018 14:24:02 +0000 (UTC) Received: by mail-wr0-f180.google.com with SMTP id l8so14303936wrg.5 for ; Sat, 17 Mar 2018 07:24:02 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6hyE9h1m9QdpOL1rLbHSi9numiFur7AV5hwmTCQJxbg=; b=FWc2vcw4vsPpWhx7v6UkLYFHHYI3VM2ndyeRlrKfQiFQNdwt4AM1FrrNFZpZoJ8OJj VBaJahxkdTWfWMmIf3vv2WC5f1HkruvAG4ZPH2N8YlFvAK4uLx+lyfB6pPi92TLZoaZf PNhC9RUCztXbbzlNQY8taPxc73WBVNDBsZljyuWDgON6DFCS2LMeaU5pj0ETJ0Fv20T8 7JA4xhMTMZy4MFIpGWiyI9idOpRkw58V/1ZFXSG3qebtjQ0BWTKgyMThL3mYwEn1WH1A i8r1UwCQf2oVip8XO2/XuyTHZZy8J06casJYas8b+QnFCI5Zp/rTnDWdqy90SvwykJ5l cAOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6hyE9h1m9QdpOL1rLbHSi9numiFur7AV5hwmTCQJxbg=; b=IpxQR2Vy3p1/5vH2cL5sBtFNBglmtvqxRxhEvNXQ6YZ/2HWBPu/ZPUQSW1rtUIlevL DLUHhjY9rtXmR4M3PylpddDrOiHxvxL4SDf6euuUI+Gds8OfLRTx/+MZnMteE3TJ9f1S YyrybO5NNru+JHRdoIShv9MG7GDIjAPNxn+ApdP7sJZTjAYIu6H7/O2mttS9WJW6I4Im JIsKOqdDDXXoE/5G3rgnb1OFOFfdmqXn0IJ/3JO7GzCb+YAZ4WE4VozMqtUDvRJbTtNn W3lofABdQrUZKg8/686NCjY2xx2250dkd4GtlT5tN36o/9u63yekD3/QUl0HrX5ZZcxM W/bw== X-Gm-Message-State: AElRT7FopRIjV/vNXbHj2qROdmoDgMHN7J8sTKYF75KhyYliNbBOKxtG ZiZMTR44KzSXY4Da0ic9priI1UAy X-Google-Smtp-Source: AG47ELv6ml4TaIjEC/ywzy09gi6VoEItaC9+vk2udWgerjPudOamNiDdc2SIUcl/bo4HmgiBOLtDJQ== X-Received: by 10.223.160.42 with SMTP id k39mr4950782wrk.138.1521296640881; Sat, 17 Mar 2018 07:24:00 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:30 +0000 Message-Id: <20180317142340.11653-13-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:02 +0000 (UTC) for IP:'209.85.128.180' DOMAIN:'mail-wr0-f180.google.com' HELO:'mail-wr0-f180.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.180 mail-wr0-f180.google.com 209.85.128.180 mail-wr0-f180.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 12/22] apibuild: Simplify uniq function 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:25:44 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use a set (unordered collections of unique elements) [1] to remove repeated elements in a list. 1: https://docs.python.org/3/tutorial/datastructures.html#sets Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 8fecf5a81..149cd41cc 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -130,11 +130,7 @@ def escape(raw): return raw =20 def uniq(items): - d =3D {} - for item in items: - d[item] =3D 1 - k =3D sorted(d.keys()) - return k + return sorted(set(items)) =20 class identifier: def __init__(self, name, header=3DNone, module=3DNone, type=3DNone, li= neno=3D0, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296748311288.30247325031894; Sat, 17 Mar 2018 07:25:48 -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 1742280F98; Sat, 17 Mar 2018 14:25:47 +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 D8D106A944; Sat, 17 Mar 2018 14:25:46 +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 A260F4CAA3; Sat, 17 Mar 2018 14:25:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO4H4000616 for ; Sat, 17 Mar 2018 10:24:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9EB1280E82; Sat, 17 Mar 2018 14:24:04 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97C6180E81 for ; Sat, 17 Mar 2018 14:24:04 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0E6083F45 for ; Sat, 17 Mar 2018 14:24:03 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id t6so7934148wmt.5 for ; Sat, 17 Mar 2018 07:24:03 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hi1CmCS0svrq2QYxm8MNyRehlaXG39W9neffVkD7qdg=; b=n1kJ1/cbvw5MrlZTpiG8XS4hsBRwC9U+J6cXgwvizDbZWOSd73dJ3TpXiv640qRTPY eNP18L755D+ulHNv6VKcg5YJj2SAQkFTYV9fHfmCG7jdmFrKk7X0TmsdiJb558bgPoGf bGCda6zBTk3V7n9ZJgFx+l+bisO4uelXhF3BHfypHfXPFPey15qvFO01lMH0Lr+7RPT5 2a7Od3ElqDVdegJWLCcVMiS9bSWqYlRO/SGVpRjEJRBZPXYuYLCCLyqwAK4TTJXfwYj5 JIKwnk2YIllUMbSaasYg/5mzNRSiubM3SPaFR8FVyrlKFMFDtg5eag9D1MaZtk0FBtbt D84g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hi1CmCS0svrq2QYxm8MNyRehlaXG39W9neffVkD7qdg=; b=iPBIgPobygBBAWRD/cr08JZiWQ/qPTqLeRZ/SJ2YyJ7vQsUCYFZOTjVfC9aZk4jU4u KoQbfKLG+5APIiM4qscMcEFCzhVNVBZzA9QmrrRD14yAeFUS/uD8gjd9lGz1Tq99lGhw tIT2jX2GRb09OZIdKTkTbX5SgfDppMikCR7Cru50ttt839l8tZRuPWxygAY4EmfK05I2 7XWvFvcLeno1lqOZPwm2qzSR0zi99nAsa774dY/4arPGGaLHiEja1SuEGgxXwkccpP4D sngnKlIC6q7nPyW/sSbwVHqiBtnCrFSDylFnwWu7YiAnYAkk/ohmV3b8SrlAdciPN+E5 WOdg== X-Gm-Message-State: AElRT7EZQaBED4TzLypu8uPOZ5+rmsDK6NhKxWakHg2RY1WLCkw1pgmQ Xn507k562uPbqZd6BJowsNwyaHck X-Google-Smtp-Source: AG47ELuI+YyuLaaWH3XAVp4x+7JI5ZDpvqVo+b4WysQEbKzg2gr49lOl5z7EcoXrTHXCYASBCgfrPQ== X-Received: by 10.28.138.143 with SMTP id m137mr4751861wmd.85.1521296642134; Sat, 17 Mar 2018 07:24:02 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:31 +0000 Message-Id: <20180317142340.11653-14-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:04 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 13/22] apibuild: Avoid double sorting of ids 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: , MIME-Version: 1.0 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.27]); Sat, 17 Mar 2018 14:25:47 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The uniq() function returns a sorted list, there is no need to sort this list again. Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 149cd41cc..400be124f 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -2319,8 +2319,7 @@ class docBuilder: if desc.find("DEPRECATED") !=3D -1: output.write(" \n") =20 - ids =3D sorted(dict.macros.keys()) - for id in uniq(ids): + for id in uniq(dict.macros.keys()): # Macros are sometime used to masquerade other types. if id in dict.functions: continue @@ -2335,20 +2334,15 @@ class docBuilder: if id in dict.enums: continue output.write(" \n" = % (id)) - ids =3D sorted(dict.enums.keys()) - for id in uniq(ids): + for id in uniq(dict.enums.keys()): output.write(" \n" %= (id)) - ids =3D sorted(dict.typedefs.keys()) - for id in uniq(ids): + for id in uniq(dict.typedefs.keys()): output.write(" \n= " % (id)) - ids =3D sorted(dict.structs.keys()) - for id in uniq(ids): + for id in uniq(dict.structs.keys()): output.write(" \n"= % (id)) - ids =3D sorted(dict.variables.keys()) - for id in uniq(ids): + for id in uniq(dict.variables.keys()): output.write(" \= n" % (id)) - ids =3D sorted(dict.functions.keys()) - for id in uniq(ids): + for id in uniq(dict.functions.keys()): output.write(" \= n" % (id)) output.write(" \n") =20 @@ -2364,7 +2358,6 @@ class docBuilder: list(dict.typedefs.keys()) + \ list(dict.structs.keys()) + \ list(dict.enums.keys())) - ids.sort() for id in ids: output.write(" \n" % (id)) output.write(" \n") --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296893341648.4369249625083; Sat, 17 Mar 2018 07:28:13 -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 DCD3680461; Sat, 17 Mar 2018 14:28:11 +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 B1F617B554; Sat, 17 Mar 2018 14:28:11 +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 775CF4CA9C; Sat, 17 Mar 2018 14:28:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO5Zj000624 for ; Sat, 17 Mar 2018 10:24:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFA3380E81; Sat, 17 Mar 2018 14:24:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E828F77D48 for ; Sat, 17 Mar 2018 14:24:05 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24AE583F45 for ; Sat, 17 Mar 2018 14:24:05 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id h21so7960371wmd.1 for ; Sat, 17 Mar 2018 07:24:05 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3oa30uuJqgK/pk+Itep0ceI9gMuMz2YcZISsxX5yX+k=; b=XhhEwOmTXOyptQrWfySuZfZyz9yJ7TnzEaj/OBZChfh65niex+uP8scuCv5CycV46X +ejQt48dci+bRTUmgU569Rmx1UiPxrzr+eDHCWvhpzJPoyMG+YyKrGIdX1+XL93JtHNh J6qSqP2aZPoN4YpHDRWA33T7eX5Vcj4iggKWXAlD6FQNPJmW6M6zpuadLqWkUZJGdDNh t2EHMzLKzldh71Duvg08goUSiUN9PVGW6ZLjqH40UoQ1X9OSaXKur5iZJAutNiTetLVe UnS/VWZ0cMUzEu91BqWRQhSIAjH3guAw1l/RK7wA67Pa18OUa94mTqHSpL86qeRvR9cG xNOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3oa30uuJqgK/pk+Itep0ceI9gMuMz2YcZISsxX5yX+k=; b=Tvsl5aAybF2sPsjIiy4E3nXmKFPVijCnM2kd7exuL7mkC+CC1BeZ1URgNC/zcX5nUi BZd9g1zNW4CBglXbS9QIaDNZT4A8HHS9N9moKyG3VA2QgKPN8I4J/NgYPkDZTkIXAMYx A1L23K1QXe4nqn23aWKbiy+zkD9O7zaQA+A9Fj0gBfT3MP8M3lQLCjaSMTfbH5izg/Qs 0BUnkfHEPA4vTPbFcg3BZSEovbcXZLL1ZXt1sA+7Sl3lOIZToQgxCzK15ihKfKnpONVc Swcwcj64u+u/+WafxeQlgPnS+FVsS7ajXd6qpeIq4QLHnGCw9todxyNtV8RfwlEUyqST aSdA== X-Gm-Message-State: AElRT7Hbot5zB08F2b6UFftI8T2BF/utSG4kLU551ZczWSkAkVHok5LR ke1HbHJpXGteoHcEFHsGZvfiecW4 X-Google-Smtp-Source: AG47ELthmrGbpr0ItDkRMpT5kR3PbURlpLAdtw4T5DGxJtIybyirieC/VEFUOiHQjPeQW8dLZTxg8w== X-Received: by 10.28.61.65 with SMTP id k62mr4691735wma.140.1521296643525; Sat, 17 Mar 2018 07:24:03 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:32 +0000 Message-Id: <20180317142340.11653-15-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:05 +0000 (UTC) for IP:'74.125.82.66' DOMAIN:'mail-wm0-f66.google.com' HELO:'mail-wm0-f66.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.66 mail-wm0-f66.google.com 74.125.82.66 mail-wm0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 14/22] python3: cpu-reformat: Use the print() function 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: , MIME-Version: 1.0 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.28]); Sat, 17 Mar 2018 14:28:12 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Replace the print statement, that is only available in Py2, with a print function that is available in both Py2 and Py3 and drop the explicit python version in the shebang. Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/cputestdata/cpu-reformat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-refo= rmat.py index 33976e775..d4ed8d811 100755 --- a/tests/cputestdata/cpu-reformat.py +++ b/tests/cputestdata/cpu-reformat.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python =20 import sys import json @@ -6,4 +6,4 @@ import json dec =3D json.JSONDecoder() data, pos =3D dec.raw_decode(sys.stdin.read()) json.dump(data, sys.stdout, indent=3D2, separators=3D(',', ': ')) -print +print("\n") --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152129689589689.64772975522192; Sat, 17 Mar 2018 07:28:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8110180469; Sat, 17 Mar 2018 14:28:14 +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 5BBEA620C3; Sat, 17 Mar 2018 14:28:14 +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 28BE54CA9E; Sat, 17 Mar 2018 14:28:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO70g000638 for ; Sat, 17 Mar 2018 10:24:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id B276480E81; Sat, 17 Mar 2018 14:24:07 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ABDDE77D48 for ; Sat, 17 Mar 2018 14:24:07 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65B2E356C1 for ; Sat, 17 Mar 2018 14:24:06 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id 139so7948932wmn.2 for ; Sat, 17 Mar 2018 07:24:06 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SwfMe23PU1TpiTnTcIQHWUY4AkRLd9laZbXYbswJosw=; b=MVPrSMKJNbaPEVWZCexmTGiFE+QrpEwvqZS1Po0j79bFk/2f5B89aiBpEd7xuGlOwy 0wdM+nOwmJnm9xX2VGFHVck70lb7u6gC4gUIgd62TfIudhRrjhNrF2XSXXK/Q/ZNjSfi qOXv8UtlimF1JR5aBNflLkMV8Oj9LSquPhqfBONi/xvmJS+jBp2lrcceXT+zJDjIL6nn oInfuWCrbTGI8kXPSuvb8LjWFwk9EGGMus3XmAWiEfzLviQzrnFepKKa4XxJ2lwfYGnd chKMC8qwzcsEVNvKNcvC19gIq89j+bkF9QYE4ouwlmDSrS87AP8ohVZrW1W9L3YH5P0j bywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SwfMe23PU1TpiTnTcIQHWUY4AkRLd9laZbXYbswJosw=; b=tcFGdH7ldQZOIZBr7tYvlo18EvYmDnHVqLd2obZFpgkEJSdfWxIzDGyxQwITgX9t0x TySxGfqox2PUlL6xp4+9sJSxWFX+JCK+4/ZbnZrBrC5i7OCgX0wm7gLDYv1wHIeqyBlF AGFcZmh12PIeazM6LCTLxqlZ6GnO2djW2uxjEH+NybDkY2OV0bdnRafR9scbuKqnrH16 YGlHGb83iZqH17XJqXwDhP2TJKalpre4LtNxyiVMcrsQWAPgTzTSkJjA7MFHfBlr8w0E BMxHaNhUwpvZmayrI6B6kRSlw1c2uNAuRe2sKw3dqHHwNPZULkQHoP937PgQacDd2BH8 8Adw== X-Gm-Message-State: AElRT7GvvHLPbW55QK36C+LqsItl4CzQknmDMri/FoRxaAj+TJciGi0g Dla11/dGnVbyNPFZlMtnvA0doI1Z X-Google-Smtp-Source: AG47ELsoXA+zEadhSmUA+4Uw8/UQYWAkcvxn6KTT6z3nM9FrlG1pj72laj+YKUCcIBU5zcZZnaPB+w== X-Received: by 10.28.138.6 with SMTP id m6mr4667589wmd.146.1521296644821; Sat, 17 Mar 2018 07:24:04 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:33 +0000 Message-Id: <20180317142340.11653-16-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:06 +0000 (UTC) for IP:'74.125.82.65' DOMAIN:'mail-wm0-f65.google.com' HELO:'mail-wm0-f65.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.65 mail-wm0-f65.google.com 74.125.82.65 mail-wm0-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 15/22] apibuild: Drop backslash between brackets 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Mar 2018 14:28:15 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Backslash between brackets in Python is redundant. [1] 1: https://lintlyci.github.io/Flake8Rules/rules/E502.html Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 400be124f..bcf7e5c24 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -385,8 +385,8 @@ class index: # check that function condition agrees with header if idx.functions[id].conditionals !=3D \ self.functions[id].conditionals: - self.warning("Header condition differs from Function = for %s:" \ - % id) + self.warning("Header condition differs from Function" + " for %s:" % id) self.warning(" H: %s" % self.functions[id].condition= als) self.warning(" C: %s" % idx.functions[id].conditiona= ls) up =3D idx.functions[id] @@ -1883,7 +1883,7 @@ class CParser: raise Exception() except: self.error(("struct '%s' is not allowed to contain lon= g " - "field '%s', use long long instead") \ + "field '%s', use long long instead") % (name, field[1])) =20 # @@ -1940,8 +1940,8 @@ class CParser: if token[1] =3D=3D "[": type =3D type + token[1] token =3D self.token() - while token is not None and (token[0] !=3D "sep" or \ - token[1] !=3D ";"): + while token is not None and (token[0] !=3D "sep" or + token[1] !=3D ";"): type =3D type + token[1] token =3D self.token() =20 @@ -1955,9 +1955,9 @@ class CParser: token =3D self.parseBlock(token) else: self.comment =3D None - while token is not None and (token[0] !=3D "sep" or \ - (token[1] !=3D ';' and token[1] !=3D ',')): - token =3D self.token() + while token is not None and (token[0] !=3D "sep" or + token[1] not in ',;'): + token =3D self.token() self.comment =3D None if token is None or token[0] !=3D "sep" or (token[1] !=3D = ';' and token[1] !=3D ','): @@ -2352,11 +2352,11 @@ class docBuilder: module =3D self.modulename_file(file) output.write(" \n" % (module)) dict =3D self.headers[file] - ids =3D uniq(list(dict.functions.keys()) + \ - list(dict.variables.keys()) + \ - list(dict.macros.keys()) + \ - list(dict.typedefs.keys()) + \ - list(dict.structs.keys()) + \ + ids =3D uniq(list(dict.functions.keys()) + + list(dict.variables.keys()) + + list(dict.macros.keys()) + + list(dict.typedefs.keys()) + + list(dict.structs.keys()) + list(dict.enums.keys())) for id in ids: output.write(" \n" % (id)) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296754619469.33919218974995; Sat, 17 Mar 2018 07:25:54 -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 68AE5680E2; Sat, 17 Mar 2018 14:25:53 +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 3C50680E98; Sat, 17 Mar 2018 14:25:53 +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 EB5EC180BAE9; Sat, 17 Mar 2018 14:25:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOCES000678 for ; Sat, 17 Mar 2018 10:24:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAEBC6134A; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5D4B600C0 for ; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E9DB19CBC4 for ; Sat, 17 Mar 2018 14:24:08 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id t3so7952314wmc.2 for ; Sat, 17 Mar 2018 07:24:08 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=efFjLp8RGmTwS56dA8GNf/rwljSHVsfkjRjQPSixny8=; b=S1RW3zXueg8B2zxsrwylNICtxpAjy3vD0IbDo3XTFgAZqmfWKa6dRUcEWlwj9uXY2c v+VI3q0emlr0xFilbi6J/JKA+dpvmGTtQjKs0PqKDiB/puIjs8ND9jRq++YkPYQujG+M NFHHgBgTfUlCiOIHW/9ZOx2rvKFvaVqdJEu+JUyVcGJwTaz6XpMdB3/a08CZCsvndvmM +pqFnxe9x+12UgrdCBb4MMBV4amJI/6ZudIM95TZy2mZJb1NjImDOBqDPqy4yVEO6aS0 mQIYDMdKHITh+sNqDGa5Pg+Uisb9HXyvMcS4VibARyzBLtLNeK2U0io84oLc18BMRgEw smfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=efFjLp8RGmTwS56dA8GNf/rwljSHVsfkjRjQPSixny8=; b=i9Ka7PLbybgttJGXS+MeLMCh7+DFVU0s3oSkXrCPmZMW+WLlC8cuBN9KOT6Q4+Fg2l e2MzNUA9sYMh1n2tpczHHcbE5w6ns5xC8FWE/q1WRhH1kXeu5le9dQbnuKZrezEjIrJ0 gRVa2msAsJ8gXbzW7IEwC4ReN7AGLvvuxRjel5YQvSZZppA5Pfey1+xWMt5eaZaRiPSa eOTq6Trhc4R8yMCNtBKIpR0X9uNPqaeW+OsehYtveZrFiVEZQDyLqHsRjippVTS0XdsD GGhhVN/CtcKr5vDOreTKCkSmV9S7cpBPGrqz7PNu15+H0iblQsz0LQr7v07vWE4+BgGj cf+A== X-Gm-Message-State: AElRT7H/Pq8+BUCG7Qh0MyG/PnQ9R03okvuRk1pfgrRKQvX+Ew2uwwAM HTDIFexDY5OY+YHYx1JmujJ6cJEW X-Google-Smtp-Source: AG47ELtkVKh4vMu5a10+IuBWGjQlAWWhIwn0aa/HA1l8PXaML3CgmFyUF0i8kgt0ogckfOhXCsR7pw== X-Received: by 10.28.50.69 with SMTP id y66mr4644557wmy.133.1521296646470; Sat, 17 Mar 2018 07:24:06 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:34 +0000 Message-Id: <20180317142340.11653-17-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:08 +0000 (UTC) for IP:'74.125.82.65' DOMAIN:'mail-wm0-f65.google.com' HELO:'mail-wm0-f65.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_FILL_THIS_FORM_SHORT) 74.125.82.65 mail-wm0-f65.google.com 74.125.82.65 mail-wm0-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 16/22] apibuild: Fix indentation not multiple of 4 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: , MIME-Version: 1.0 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.38]); Sat, 17 Mar 2018 14:25:53 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PEP8 recommends that the number of spaces used for indentation of Python code to be a multiple of four [1] [2]. 1: https://lintlyci.github.io/Flake8Rules/rules/E111.html 2: https://lintlyci.github.io/Flake8Rules/rules/E114.html Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 298 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 151 insertions(+), 147 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index bcf7e5c24..9e73b4d27 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -248,11 +248,12 @@ class index: return None d =3D None try: - d =3D self.identifiers[name] - d.update(header, module, type, lineno, info, extra, conditional= s) + d =3D self.identifiers[name] + d.update(header, module, type, lineno, info, extra, conditiona= ls) except: - d =3D identifier(name, header, module, type, lineno, info, extr= a, conditionals) - self.identifiers[name] =3D d + d =3D identifier(name, header, module, type, lineno, info, ext= ra, + conditionals) + self.identifiers[name] =3D d =20 if d is not None and static =3D=3D 1: d.set_static(1) @@ -265,16 +266,18 @@ class index: =20 return d =20 - def add(self, name, header, module, static, type, lineno, info=3DNone,= extra=3DNone, conditionals=3DNone): + def add(self, name, header, module, static, type, lineno, info=3DNone, + extra=3DNone, conditionals=3DNone): if name[0:2] =3D=3D '__': return None d =3D None try: - d =3D self.identifiers[name] - d.update(header, module, type, lineno, info, extra, conditional= s) + d =3D self.identifiers[name] + d.update(header, module, type, lineno, info, extra, conditiona= ls) except: - d =3D identifier(name, header, module, type, lineno, info, extr= a, conditionals) - self.identifiers[name] =3D d + d =3D identifier(name, header, module, type, lineno, info, ext= ra, + conditionals) + self.identifiers[name] =3D d =20 if d is not None and static =3D=3D 1: d.set_static(1) @@ -308,93 +311,94 @@ class index: =20 def merge(self, idx): for id in idx.functions.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.macros: - del self.macros[id] - if id in self.functions: - self.warning("function %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.macros: + del self.macros[id] + if id in self.functions: + self.warning("function %s from %s redeclared in %s" % ( id, self.functions[id].header, idx.functions[id].heade= r)) - else: - self.functions[id] =3D idx.functions[id] - self.identifiers[id] =3D idx.functions[id] + else: + self.functions[id] =3D idx.functions[id] + self.identifiers[id] =3D idx.functions[id] for id in idx.variables.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.macros: - del self.macros[id] - if id in self.variables: - self.warning("variable %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.macros: + del self.macros[id] + if id in self.variables: + self.warning("variable %s from %s redeclared in %s" % ( id, self.variables[id].header, idx.variables[id].heade= r)) - else: - self.variables[id] =3D idx.variables[id] - self.identifiers[id] =3D idx.variables[id] + else: + self.variables[id] =3D idx.variables[id] + self.identifiers[id] =3D idx.variables[id] for id in idx.structs.keys(): - if id in self.structs: - self.warning("struct %s from %s redeclared in %s" % ( + if id in self.structs: + self.warning("struct %s from %s redeclared in %s" % ( id, self.structs[id].header, idx.structs[id].header)) - else: - self.structs[id] =3D idx.structs[id] - self.identifiers[id] =3D idx.structs[id] + else: + self.structs[id] =3D idx.structs[id] + self.identifiers[id] =3D idx.structs[id] for id in idx.unions.keys(): - if id in self.unions: - print("union %s from %s redeclared in %s" % ( + if id in self.unions: + print("union %s from %s redeclared in %s" % ( id, self.unions[id].header, idx.unions[id].header)) - else: - self.unions[id] =3D idx.unions[id] - self.identifiers[id] =3D idx.unions[id] + else: + self.unions[id] =3D idx.unions[id] + self.identifiers[id] =3D idx.unions[id] for id in idx.typedefs.keys(): - if id in self.typedefs: - self.warning("typedef %s from %s redeclared in %s" % ( + if id in self.typedefs: + self.warning("typedef %s from %s redeclared in %s" % ( id, self.typedefs[id].header, idx.typedefs[id].header)) - else: - self.typedefs[id] =3D idx.typedefs[id] - self.identifiers[id] =3D idx.typedefs[id] + else: + self.typedefs[id] =3D idx.typedefs[id] + self.identifiers[id] =3D idx.typedefs[id] for id in idx.macros.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.variables: - continue - if id in self.functions: - continue - if id in self.enums: - continue - if id in self.macros: - self.warning("macro %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.variables: + continue + if id in self.functions: + continue + if id in self.enums: + continue + if id in self.macros: + self.warning("macro %s from %s redeclared in %s" % ( id, self.macros[id].header, idx.macros[id].header)) - else: - self.macros[id] =3D idx.macros[id] - self.identifiers[id] =3D idx.macros[id] + else: + self.macros[id] =3D idx.macros[id] + self.identifiers[id] =3D idx.macros[id] for id in idx.enums.keys(): - if id in self.enums: - self.warning("enum %s from %s redeclared in %s" % ( + if id in self.enums: + self.warning("enum %s from %s redeclared in %s" % ( id, self.enums[id].header, idx.enums[id].header)) - else: - self.enums[id] =3D idx.enums[id] - self.identifiers[id] =3D idx.enums[id] + else: + self.enums[id] =3D idx.enums[id] + self.identifiers[id] =3D idx.enums[id] =20 def merge_public(self, idx): for id in idx.functions.keys(): - if id in self.functions: - # check that function condition agrees with header - if idx.functions[id].conditionals !=3D \ - self.functions[id].conditionals: - self.warning("Header condition differs from Function" - " for %s:" % id) - self.warning(" H: %s" % self.functions[id].condition= als) - self.warning(" C: %s" % idx.functions[id].conditiona= ls) - up =3D idx.functions[id] - self.functions[id].update(None, up.module, up.type, up.in= fo, up.extra) - # else: - # print("Function %s from %s is not declared in headers" = % ( - # id, idx.functions[id].module)) - # TODO: do the same for variables. + if id in self.functions: + # check that function condition agrees with header + if idx.functions[id].conditionals !=3D \ + self.functions[id].conditionals: + self.warning("Header condition differs from Function" + " for %s:" % id) + self.warning(" H: %s" % self.functions[id].conditiona= ls) + self.warning(" C: %s" % idx.functions[id].conditional= s) + up =3D idx.functions[id] + self.functions[id].update(None, up.module, up.type, up.inf= o, + up.extra) + # else: + # print("Function %s from %s is not declared in headers" %= ( + # id, idx.functions[id].module)) + # TODO: do the same for variables. =20 def analyze_dict(self, type, dict): count =3D 0 @@ -726,7 +730,7 @@ class CParser: elif line[i] =3D=3D '*': return line[:i] + line[i + 1:] else: - return line + return line return line =20 def cleanupComment(self): @@ -877,11 +881,11 @@ class CParser: =20 return((args, desc)) =20 - # - # Parse a comment block and merge the information found in the - # parameters descriptions, finally returns a block as complete - # as possible - # + # + # Parse a comment block and merge the information found in the + # parameters descriptions, finally returns a block as complete + # as possible + # def mergeFunctionComment(self, name, description, quiet=3D0): global ignored_functions =20 @@ -989,9 +993,9 @@ class CParser: desc =3D desc.strip() =20 if quiet =3D=3D 0: - # - # report missing comments - # + # + # report missing comments + # i =3D 0 while i < nbargs: if args[i][2] is None and args[i][0] !=3D "void" and args[= i][1] is not None: @@ -1023,7 +1027,7 @@ class CParser: if token is None: return None if token[0] =3D=3D 'preproc': - # TODO macros with arguments + # TODO macros with arguments name =3D token[1] lst =3D [] token =3D self.lexer.token() @@ -1108,11 +1112,11 @@ class CParser: token =3D self.lexer.token() return token =20 - # - # token acquisition on top of the lexer, it handle internally - # preprocessor and comments since they are logically not part of - # the program structure. - # + # + # token acquisition on top of the lexer, it handle internally + # preprocessor and comments since they are logically not part of + # the program structure. + # def push(self, tok): self.lexer.push(tok) =20 @@ -1149,9 +1153,9 @@ class CParser: return token return None =20 - # - # Parse a typedef, it records the type and its name. - # + # + # Parse a typedef, it records the type and its name. + # def parseTypedef(self, token): if token is None: return None @@ -1161,7 +1165,7 @@ class CParser: return None base_type =3D self.type type =3D base_type - #self.debug("end typedef type", token) + # self.debug("end typedef type", token) while token is not None: if token[0] =3D=3D "name": name =3D token[1] @@ -1186,7 +1190,7 @@ class CParser: else: self.error("parsing typedef: expecting a name") return token - #self.debug("end typedef", token) + # self.debug("end typedef", token) if token is not None and token[0] =3D=3D 'sep' and token[1] = =3D=3D ',': type =3D base_type token =3D self.token() @@ -1204,10 +1208,10 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a C code block, used for functions it parse till - # the balancing } included - # + # + # Parse a C code block, used for functions it parse till + # the balancing } included + # def parseBlock(self, token): while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": @@ -1243,27 +1247,27 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a C struct definition till the balancing } - # + # + # Parse a C struct definition till the balancing } + # def parseStruct(self, token): fields =3D [] - #self.debug("start parseStruct", token) + # self.debug("start parseStruct", token) while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": token =3D self.token() token =3D self.parseTypeBlock(token) elif token[0] =3D=3D "sep" and token[1] =3D=3D "}": self.struct_fields =3D fields - #self.debug("end parseStruct", token) - #print(fields) + # self.debug("end parseStruct", token) + # print(fields) token =3D self.token() return token else: base_type =3D self.type - #self.debug("before parseType", token) + # self.debug("before parseType", token) token =3D self.parseType(token) - #self.debug("after parseType", token) + # self.debug("after parseType", token) if token is not None and token[0] =3D=3D "name": fname =3D token[1] token =3D self.token() @@ -1294,13 +1298,13 @@ class CParser: token =3D self.token() self.type =3D base_type self.struct_fields =3D fields - #self.debug("end parseStruct", token) - #print(fields) + # self.debug("end parseStruct", token) + # print(fields) return token =20 - # - # Parse a C union definition till the balancing } - # + # + # Parse a C union definition till the balancing } + # def parseUnion(self, token): fields =3D [] # self.debug("start parseUnion", token) @@ -1348,9 +1352,9 @@ class CParser: # print(fields) return token =20 - # - # Parse a C enum block, parse till the balancing } - # + # + # Parse a C enum block, parse till the balancing } + # def parseEnumBlock(self, token): self.enums =3D [] name =3D None @@ -1513,10 +1517,10 @@ class CParser: =20 return token =20 - # - # Parse a C definition block, used for structs or unions it parse till - # the balancing } - # + # + # Parse a C definition block, used for structs or unions it parse till + # the balancing } + # def parseTypeBlock(self, token): while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": @@ -1529,11 +1533,11 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a type: the fact that the type name can either occur after - # the definition or within the definition makes it a little harder - # if inside, the name token is pushed back before returning - # + # + # Parse a type: the fact that the type name can either occur after + # the definition or within the definition makes it a little harder + # if inside, the name token is pushed back before returning + # def parseType(self, token): self.type =3D "" self.struct_fields =3D [] @@ -1711,9 +1715,9 @@ class CParser: self.type =3D self.type + " " + token[1] token =3D self.token() =20 - # - # if there is a parenthesis here, this means a function type - # + # + # if there is a parenthesis here, this means a function type + # if token is not None and token[0] =3D=3D "sep" and token[1] =3D=3D= '(': self.type =3D self.type + token[1] token =3D self.token() @@ -1744,9 +1748,9 @@ class CParser: token =3D nametok return token =20 - # - # do some lookahead for arrays - # + # + # do some lookahead for arrays + # if token is not None and token[0] =3D=3D "name": nametok =3D token token =3D self.token() @@ -1766,7 +1770,7 @@ class CParser: self.error("parsing array type, ']' expected", token) return token elif token is not None and token[0] =3D=3D "sep" and token[1] = =3D=3D ':': - # remove :12 in case it's a limited int size + # remove :12 in case it's a limited int size token =3D self.token() token =3D self.token() self.lexer.push(token) @@ -1774,9 +1778,9 @@ class CParser: =20 return token =20 - # - # Parse a signature: '(' has been parsed and we scan the type definit= ion - # up to the ')' included + # + # Parse a signature: '(' has been parsed and we scan the type definiti= on + # up to the ')' included def parseSignature(self, token): signature =3D [] if token is not None and token[0] =3D=3D "sep" and token[1] =3D=3D= ')': @@ -1792,7 +1796,7 @@ class CParser: token =3D self.token() continue elif token is not None and token[0] =3D=3D "sep" and token[1] = =3D=3D ')': - # only the type was provided + # only the type was provided if self.type =3D=3D "...": signature.append((self.type, "...", None)) else: @@ -1886,10 +1890,10 @@ class CParser: "field '%s', use long long instead") % (name, field[1])) =20 - # - # Parse a global definition, be it a type, variable or function - # the extern "C" blocks are a bit nasty and require it to recurse. - # + # + # Parse a global definition, be it a type, variable or function + # the extern "C" blocks are a bit nasty and require it to recurse. + # def parseGlobal(self, token): static =3D 0 if token[1] =3D=3D 'extern': @@ -1946,9 +1950,9 @@ class CParser: token =3D self.token() =20 if token is not None and token[0] =3D=3D "op" and token[1] =3D= =3D "=3D": - # - # Skip the initialization of the variable - # + # + # Skip the initialization of the variable + # token =3D self.token() if token[0] =3D=3D 'sep' and token[1] =3D=3D '{': token =3D self.token() --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296751514343.40246091686663; Sat, 17 Mar 2018 07:25:51 -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 17E0E356C1; Sat, 17 Mar 2018 14:25:50 +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 E661D7EE23; Sat, 17 Mar 2018 14:25:49 +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 AFAFD180BAD8; Sat, 17 Mar 2018 14:25:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOCiT000679 for ; Sat, 17 Mar 2018 10:24:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBF4D183C6; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B27F160BE7 for ; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BD1883F45 for ; Sat, 17 Mar 2018 14:24:09 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id w128so8021275wmw.0 for ; Sat, 17 Mar 2018 07:24:09 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LJUYctf2rl1Akan+AHZU5s+DCOzqtaR+D1QuVPKc37A=; b=pPWrIyJWomdR9efRaiXK+lWOsuAWCdOO34a3mrfhOjOkuXuLrluXuv/p7dcM7GZMGQ mrr1wq4RpSstewfOhH3Nuqovq302U4qBUGhrERx71soZrsPcbBcp/iAiuj6GM3H+NrgY LPttoRxe6bjx2OkEK/B8rstuRMwKOzZNx0RxEftW0Eh3gZofh2v1gbXDZUwKfzG3mIs5 sj1pPvT/i6O3g0z2dOvOfG/dUq2joXJHO6u9Yo8kLgXBJ14yOXupF9Wv+21hsPxmHTwM avfAuBpr4ZpR0p1413eHRfqlevAWvWEh/xWot59drVFmPw62BjHwWwaMo4A/obx9OGbX rvpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LJUYctf2rl1Akan+AHZU5s+DCOzqtaR+D1QuVPKc37A=; b=fJNG7sKFHvg4C1EauypAqvp7nAL5TIPB/QR9tBr39f1kiEiTuQVZ/Y35hqGMlAHGeT ts6dT0O+rVOSRPb8em8uwZ6Ay9hp6CfLs9IQDQXdYmFKy1GycPyI6EPy4jgVkPaj8DvZ Zut7lsfGi2a+0kPcAF6ilftar0uTEQ8/p+fwi13nL3QxiNSZr0Oc0VPv2ZJ8rW3cLxOj btvjhKVC3IFB+YEKb8nelvGm3sPqSavMoeTKG8AsDuvBp3sJ1UVuxTmEsjEvnwYnkZU9 gOkUqQtMbl3acFx14u0mwP45eWw/oqre3bDIyu8XU8StqRnd+BZRQrpitZaXyoKHt0lI e0EA== X-Gm-Message-State: AElRT7FOPbKW2RiO6Vc2SrJPQHZPRYZJmJnUANuu5khWRg4K8Hlr/FJh o0uo13HdFATBotFhjV2kY7e4byTM X-Google-Smtp-Source: AG47ELtKH/51rSMV6+/VwKJoVcI7BO20C9sL/o5/+05o6UpiLSL3gFu43r+hD6EbQ55oF+H2MFz6wg== X-Received: by 10.28.43.66 with SMTP id r63mr4725113wmr.93.1521296647791; Sat, 17 Mar 2018 07:24:07 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:35 +0000 Message-Id: <20180317142340.11653-18-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:09 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 17/22] apibuild: Simplify strip_lead_star() 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: , MIME-Version: 1.0 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.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:25:50 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The method strip_lead_star() removes a single leading asterisk character from a string by ignoring leading whitespace, otherwise it returns the original string. This could be achieved with a single if-statement followed by replace. Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 9e73b4d27..b914b1dce 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -722,15 +722,8 @@ class CParser: self.index.info =3D res =20 def strip_lead_star(self, line): - l =3D len(line) - i =3D 0 - while i < l: - if line[i] =3D=3D ' ' or line[i] =3D=3D '\t': - i +=3D 1 - elif line[i] =3D=3D '*': - return line[:i] + line[i + 1:] - else: - return line + if line.lstrip().startswith('*'): + line =3D line.replace('*', '', 1) return line =20 def cleanupComment(self): --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296691298279.3349432283226; Sat, 17 Mar 2018 07:24:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8759223E6F3; Sat, 17 Mar 2018 14:24:49 +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 6104C5D70B; Sat, 17 Mar 2018 14:24:49 +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 29CD7180BADA; Sat, 17 Mar 2018 14:24:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOCrY000677 for ; Sat, 17 Mar 2018 10:24:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9A47608F4; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B41D4183C6 for ; Sat, 17 Mar 2018 14:24:11 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC4DC80F79 for ; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id a20so6480198wmd.1 for ; Sat, 17 Mar 2018 07:24:10 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CRUTCos3C8MmrS5v+ijK20QoCh3BKr2xG4vyiSN4hg8=; b=ZgpQ/T+c28GBC30WlzKvC/GMkAoJH+VXlDPl9LyklqZx4r4Wfd+rohh11n1aLwXB4V 7XZ5Bree1eWnZi/nayRJ3LmtWWOzvFiAFxJLnxVaGBN862HCAJfVCtE20BKJjHdgMSOG +0KOmiULUSI1FpR4w9+RY8gCmcC2yuly20a9e0+nOSeXtHCHrthixU2U4Shn0FN54mtK uPar+DgM/98UDk8kn+MMSBN+jVWH1nLvhkt26GRw6WXEreloyIj4VsRKr8+znom+wA0v Qy2dML58tqTHnxjNcbR2GxvsgwtBTqIJRBf3YqpSwHDWg9KAbtIab98iltIAEs0tZZfX /QQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CRUTCos3C8MmrS5v+ijK20QoCh3BKr2xG4vyiSN4hg8=; b=N7eb/M/HsmSGkDwZxyccfBQtjQG6lhrgSAbGqJp5EGSNaavY8Pp3lQSspwTKa1rLup LNJByl1ymMUvfaVcNsQ9JM5fsoc+VpM4CsU9s7sz0lSGuiRTLf9KvRKckMbDaO51oGbL 60v0TpY0XVV78auSRrxyZDt1cmxQwV5n3OAa4QrzXFp1OWDVkQ9roLLoEBNGgIK+4VDc zC6b5irN1nXSNd4D1jUmakC3xM2R8PG7YmqQ+keuzSPR5CJ5TFIeup41uZ8Jy4L5zCgh t1trSBVTG3IbvRv47A3nAVhbpn/+7GV2Z2iuR0UAsxIZ5sQ+t5wQlO0TuTUM/q/rpDA0 Dq+A== X-Gm-Message-State: AElRT7G2oG8nXmytSXEBwdHlVCWCm7wSGkDR6Lq+fGK0C3quEisfhh7N zdvhoV11+bMVgWxQIaCfYYoQaKR6 X-Google-Smtp-Source: AG47ELtzp8C01sh3Ha/LlxMbTK+LyoRj1UV8+UjC+7n1cEGVV5t7+nkp/OAJqID28l9b4ACe6uelpA== X-Received: by 10.28.9.19 with SMTP id 19mr4774965wmj.114.1521296649217; Sat, 17 Mar 2018 07:24:09 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:36 +0000 Message-Id: <20180317142340.11653-19-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:11 +0000 (UTC) for IP:'74.125.82.66' DOMAIN:'mail-wm0-f66.google.com' HELO:'mail-wm0-f66.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.66 mail-wm0-f66.google.com 74.125.82.66 mail-wm0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 18/22] apibuild: Simplify parseTypeComment() 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:50 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Improve readability and reduce complexity the method parseTypeComment(). Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index b914b1dce..fd1ee7958 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -757,48 +757,38 @@ class CParser: # # Parse a comment block associate to a typedef # - def parseTypeComment(self, name, quiet=3D0): + def parseTypeComment(self, name, quiet=3DFalse): if name[0:2] =3D=3D '__': - quiet =3D 1 - - args =3D [] - desc =3D "" + quiet =3D True =20 if self.comment is None: if not quiet: self.warning("Missing comment for type %s" % (name)) - return((args, desc)) - if self.comment[0] !=3D '*': + return None + if not self.comment.startswith('*'): if not quiet: self.warning("Missing * in type comment for %s" % (name)) - return((args, desc)) + return None + lines =3D self.comment.split('\n') - if lines[0] =3D=3D '*': - del lines[0] + # Remove lines that contain only single asterisk + lines[:] =3D [line for line in lines if line.strip() !=3D '*'] + if lines[0] !=3D "* %s:" % (name): if not quiet: self.warning("Misformatted type comment for %s" % (name)) self.warning(" Expecting '* %s:' got '%s'" % (name, lines= [0])) - return((args, desc)) + return None del lines[0] - 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 - del lines[0] =20 - desc =3D desc.strip() + # Concatenate all remaining lines by striping leading asterisks + desc =3D " ".join([line.lstrip("*").strip() for line in lines]).st= rip() =20 - if quiet =3D=3D 0: - if desc =3D=3D "": - self.warning("Type comment for %s lack description of the = macro" % (name)) + if not (quiet or desc): + self.warning("Type comment for %s lack description of the macr= o" + % (name)) =20 - return(desc) + return desc # # Parse a comment block associate to a macro # --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296694089254.71121314311404; Sat, 17 Mar 2018 07:24:54 -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 AA20B3AD93; Sat, 17 Mar 2018 14:24:52 +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 7F2625D729; Sat, 17 Mar 2018 14:24:52 +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 467C1180BAE6; Sat, 17 Mar 2018 14:24:52 +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 w2HEOGvm000708 for ; Sat, 17 Mar 2018 10:24:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 463E75DD82; Sat, 17 Mar 2018 14:24:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40D2D5D729 for ; Sat, 17 Mar 2018 14:24:13 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69FAD356C1 for ; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id n3so7948419wmd.1 for ; Sat, 17 Mar 2018 07:24:12 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gqwwnYNYjsEKaQoTI99vr5SV9Jqe6P2mWWzYbUoM0Mw=; b=WnZramGtjBCYvXk/eq7V6SNddpGuYh3CUTeGCcIcoijf5UY8OoC4rykUdM4lfoiqfL aOQJUFfrXUmKi0o356W40WtyXRRfwYh6lroCwPxwU11gB9Chhr8bgl1HSII2RksBzfja RxeWXQwE3oMh7c08ZxCxtSEFZrSzdUcjN8zU0Tx3KbEctS5gEH16ydQ5LZci51Jbrhcn FqJx+Nw41zqUtAoaxoBeO2RYkcrQqcd+la685xToll7q1y198bRB1hr9huP1L/BYHdn6 WL46lt08kC+9tfkikeIS8wNsRkqTmtMKyTUzODA4qJs58hcWJz2LeSDxKnEzPZfVDRC2 6xlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gqwwnYNYjsEKaQoTI99vr5SV9Jqe6P2mWWzYbUoM0Mw=; b=oUBQA4czUMnd7ZSWFcFFzJ1Bnz3hDZCk444cjYV+usmy1oDXdAM+a16bdX1H1JP6j4 WSPZOg2hin/yTNKo+vACc8cpt5B7GjN1Sr0kq0rI8RSbogvwc5S70Xc4oQQHOfviocSc 4vWfOJOz7laMrZNSe62TIi38YHZZciUupbEgBKdUbOM6ciECnlBl7h/+3jgdmcZb4kyh 2k7fpRn5S/ywixH8HHfYEevOHQo3CdIPLu/2sm6VL7nF9HJBuU7FQ766ZD1aZQN/dmqj rmNfZdL9pTJkeM+SDuvQLMmBGFxfC1qI8fJoV5WkaTg4CSgxCQ7d9IPuHxLSfLx7yf5D +Qjw== X-Gm-Message-State: AElRT7Hvzm54q8f+2pZqmU/Pr2Hk8il2J0RPDRlclqZ7mLmjtlZ5F2F2 84STnAOuOL+uD53y6BTssOLwHikS X-Google-Smtp-Source: AG47ELsQhMbWXrMncl+dPtYYyrXz/LJgeF2Ibz1EVwnDqJ96wLLJBSJWXTYpWIKadBddBQHvzVcUzA== X-Received: by 10.28.27.194 with SMTP id b185mr4689318wmb.57.1521296650866; Sat, 17 Mar 2018 07:24:10 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:37 +0000 Message-Id: <20180317142340.11653-20-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:12 +0000 (UTC) for IP:'74.125.82.65' DOMAIN:'mail-wm0-f65.google.com' HELO:'mail-wm0-f65.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.65 mail-wm0-f65.google.com 74.125.82.65 mail-wm0-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 19/22] apibuild: Simplify type checking of literals 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: , MIME-Version: 1.0 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.38]); Sat, 17 Mar 2018 14:24:53 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Reduce the number of if-statements used to assign a literals to corresponding class variables. Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index fd1ee7958..29c89fd24 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -283,24 +283,19 @@ class index: d.set_static(1) =20 if d is not None and name is not None and type is not None: - if type =3D=3D "function": - self.functions[name] =3D d - elif type =3D=3D "functype": - self.functions[name] =3D d - elif type =3D=3D "variable": - self.variables[name] =3D d - elif type =3D=3D "include": - self.includes[name] =3D d - elif type =3D=3D "struct": - self.structs[name] =3D d - elif type =3D=3D "union": - self.unions[name] =3D d - elif type =3D=3D "enum": - self.enums[name] =3D d - elif type =3D=3D "typedef": - self.typedefs[name] =3D d - elif type =3D=3D "macro": - self.macros[name] =3D d + type_map =3D { + "function": self.functions, + "functype": self.functions, + "variable": self.variables, + "include": self.includes, + "struct": self.structs, + "union": self.unions, + "enum": self.enums, + "typedef": self.typedefs, + "macro": self.macros + } + if type in type_map: + type_map[type][name] =3D d else: self.warning("Unable to register type ", type) =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152129690187037.041466644911566; Sat, 17 Mar 2018 07:28:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9926A65CFF; Sat, 17 Mar 2018 14:28: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 718F85D70B; Sat, 17 Mar 2018 14:28: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 3ADD3180BAD5; Sat, 17 Mar 2018 14:28:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOGvB000719 for ; Sat, 17 Mar 2018 10:24:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id DF25480E82; Sat, 17 Mar 2018 14:24:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8C8C80E81 for ; Sat, 17 Mar 2018 14:24:14 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A74995D67A for ; Sat, 17 Mar 2018 14:24:13 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id f14so14273172wre.8 for ; Sat, 17 Mar 2018 07:24:13 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qWolrdmEwLG+E2fziA4b8dbObYk+RLHWX9wStYcWqvM=; b=RzxuBjtNQNMm5awv23jPvPSZL2urnsksrlxRtJd2tvJvD7cWmFgu/s3EsdsUSjtF6W J27o2fjvVJVahBXmmWo5kOd9VPcqqyHBGHHNTUc79U01/V2qJGnUTVQ/x916aoRyCIRG hbJuLDs4ujY9GTRcVRv6NXEknzsny5ZQlzAv8mLdek/tdiCGLMDhNg145NvE1gok5o7F kB4mOu3PJmJej9dJnU+M6CmmBZa5lteuHHm0bZpgDj8LlBIyzS01aoxZvlxxPDEk3s2T HSVlpAYbThjm8g+c5XbhDVkLkrZxJmiNoVT3BmLVD9bBQN92pvBBb7BAqKDZC8v/2Ntc qVLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qWolrdmEwLG+E2fziA4b8dbObYk+RLHWX9wStYcWqvM=; b=D5dZaI7tb0tv1xyNDpDFCpOTFhzf+VitgiMsoolyjDahPKWrXlET1YRkk27JetFjt/ d8GrbPevtIm6QjzlsUXzfiDHjrw7QI/7bkgeMHxeABs+AXdhf2coUG6LkSc3sVWJpraS PdbsmZNOgvdAEEZyumPR1sMqi0XVYMiFEuLejqHuY/vYPuZOCw4nbygVIbp7qE4eDu6N dBTpM4i0pEK2ed4xqQGKqq664MqblcGxmajpvBqt4W/vjIa0xcs9DPX4S8pnCILxIP55 bk8DsEiNVKMInHCUqvw4uhEC1b2seQqX4bMNvVBAkVArpaSnSPaOD3MYwafHyZs/Iw+D F8Bw== X-Gm-Message-State: AElRT7HTWwIZRK0sG8yK53sot5TWnDeG4C7IqaK8BPfmFW/ayFeEwLSc ZnOfI6dM6UOIlbH6bk9K5zk9QPd6 X-Google-Smtp-Source: AG47ELtU0eqdEGw70IaZyszAlmE1L4HjgFLLw89XfbQnXp54fmhGNnON1Wzv/PIWM95XmS7/iPHqAA== X-Received: by 10.223.135.237 with SMTP id c42mr4942831wrc.146.1521296652127; Sat, 17 Mar 2018 07:24:12 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:38 +0000 Message-Id: <20180317142340.11653-21-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 17 Mar 2018 14:24:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 17 Mar 2018 14:24:13 +0000 (UTC) for IP:'209.85.128.194' DOMAIN:'mail-wr0-f194.google.com' HELO:'mail-wr0-f194.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.194 mail-wr0-f194.google.com 209.85.128.194 mail-wr0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 20/22] apibuild: Use list comprehension insteand of map 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:28:21 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 29c89fd24..f9784f9bd 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -472,8 +472,7 @@ class CLexer: return None =20 if line[0] =3D=3D '#': - self.tokens =3D list(map((lambda x: ('preproc', x)), - line.split())) + self.tokens =3D [('preproc', word) for word in line.split(= )] =20 # We might have whitespace between the '#' and preproc # macro name, so instead of having a single token element --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296696617415.79858814673025; Sat, 17 Mar 2018 07:24:56 -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 6CA5A7FDC3; Sat, 17 Mar 2018 14:24:55 +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 406FB7B553; Sat, 17 Mar 2018 14:24:55 +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 066CC180BAE5; Sat, 17 Mar 2018 14:24:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOGIe000720 for ; Sat, 17 Mar 2018 10:24:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id DFC1680E97; Sat, 17 Mar 2018 14:24:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8C2E77D48 for ; Sat, 17 Mar 2018 14:24:16 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4060D356CA for ; Sat, 17 Mar 2018 14:24:15 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id o1so14281379wro.10 for ; Sat, 17 Mar 2018 07:24:15 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sXZwuGrddT4jvt2hIVFuiJY95cMmUkUCeJJJQn3Q3Gw=; b=or+Dmy5HWIk1C7tdQTO70QcJrda5RKHHwIXZaJf3/yrIr82qvTb0se07S9qSSCWBnh X265DlEwDsdeAB6bGvcQu0PKf+czQR8m6XWHWS9yWM8yNn6UTz/NhGQOf2Y7PYOio5yO xozgmnetLNfpYwkAs1PAGACC6ak21Xl8XRSwTMEDa8MtpSJyrGE5ScOatd7WqpAI4xjN u06np9fxNsHnBVxFA/w6xkWsVlMliui+ZzbDbh9vJ3Wel5qwjWpy41geFwzLqNTUsdYh ShkGAUlI5jUeW4TaX91w+l3GdlZbZ5Pd/tv2yFoqtXnwWgTUNN5FaWhiYBTJAqKRmsZT ZJiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sXZwuGrddT4jvt2hIVFuiJY95cMmUkUCeJJJQn3Q3Gw=; b=mhHMsWxnftoj0a9uYJMOTNVSfJL4Ktmpt2tmrDRnKs3IsKoJu+HMqFrHO23embJIpz 3NqgEYJ2f5FAu0fjO53PuTZtI/Dd8OnJq9ZMI8cLxJ9+G3keAyZhePDx2d/hRODZNlY3 BoKtb9zqIZU8aTEwggLy9nceaKzRHW3EkBmr/1ne00ckN50WxMOMU7cEY4+oV8mbk3CM Ox2A+WRalLeeCHL+bWKTSACaSx0sjplERTz3sDPb10kZZH3PtOHprraAHuYQ7v5hqKAn hjE/VvkdlLeggSisMNr2XUx5bi1gjrNPRSlzYDQhVNpf9QwVcgbTGWBL5ilMJwkshT7e CLdQ== X-Gm-Message-State: AElRT7HhKavCggX9drEmJvmp2VapRVi4qGcO45INwIVH2dM2DYYRmmbl WnM97ZsrGEzksHdSzETt29bdv2ZV X-Google-Smtp-Source: AG47ELuGzpswIxxusIkiz2YcWzyGnhxGTUiu/gsd5FMc/NR0mWKRde/dKozfrbNjwlCxRXBmrB0uaQ== X-Received: by 10.223.129.67 with SMTP id 61mr283992wrm.240.1521296653621; Sat, 17 Mar 2018 07:24:13 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:39 +0000 Message-Id: <20180317142340.11653-22-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:24:15 +0000 (UTC) for IP:'209.85.128.193' DOMAIN:'mail-wr0-f193.google.com' HELO:'mail-wr0-f193.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.193 mail-wr0-f193.google.com 209.85.128.193 mail-wr0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 21/22] apibuild: Simplify merging of preproc tokens 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: , MIME-Version: 1.0 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.27]); Sat, 17 Mar 2018 14:24:55 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index f9784f9bd..24e0eb505 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -479,8 +479,8 @@ class CLexer: # of '#define' we might end up with '#' and 'define'. This # merges them back together if self.tokens[0][1] =3D=3D "#": - self.tokens[0] =3D ('preproc', self.tokens[0][1] + sel= f.tokens[1][1]) - self.tokens =3D self.tokens[:1] + self.tokens[2:] + self.tokens[0] =3D ('preproc', "#" + self.tokens[1][1]) + del self.tokens[1] break l =3D len(line) if line[0] =3D=3D '"' or line[0] =3D=3D "'": --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:14:06 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296905229276.10994047796; Sat, 17 Mar 2018 07:28:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF235356CE; Sat, 17 Mar 2018 14:28:23 +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 C9A36620CB; Sat, 17 Mar 2018 14:28:23 +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 9303E180BAD7; Sat, 17 Mar 2018 14:28:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOHB3000732 for ; Sat, 17 Mar 2018 10:24:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85F077EE23; Sat, 17 Mar 2018 14:24:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D3467EE14 for ; Sat, 17 Mar 2018 14:24:17 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B1BC7E9D8 for ; Sat, 17 Mar 2018 14:24:16 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id o8so14349343wra.1 for ; Sat, 17 Mar 2018 07:24:16 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NuGLo16b2FCzSqyCvz0gs/bBRq43HnobmhaSJoTGYhk=; b=Uo/5Z1r5wqmqDlJMJB52HwRoBudNBMa7P/r5jDOSz+g0TqOGQkJRStuwJWAshpEtFh yRYfB6KxfMtNq3VtmKzMeb58Hwd08mjoBS45m9j/MRzeKFVk7Hkn8RcONKd0Rw3KXFDW u83ju00RendFkbrOBPt0/uJjQKjyHk5Y1ZUcB8MqI6nUv+Q5RhNEchIU/UfVhfOg7Bj2 TxJf3e2vtV13X6bjr1xqb4B0EPFY92V1ak1lnxzDUVHRFR/aUS2fQYmTf4klXQZgd3zz uJX7h4NivPcPpzS/dRa8/YTL2DHOdztQ+onINCPP3BsWj9Q+9uX2jOIWRZUohi70YJ21 Zt/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NuGLo16b2FCzSqyCvz0gs/bBRq43HnobmhaSJoTGYhk=; b=fXJwQMINduGidBc0wghlS+lYXrkTTxQCqn1P0DY3JQqyB6XTRKYilFjaqQwo621bTF i9fImgJfuk9fKM0XgOh4wcFHu+lw0CIHr1WSoxYSIn/4CAGRaWbvbwFax7Nyw5FktTzV d0ymbxS12uVtXz/GkucmZcu+cXYXFoHn3rltSLV9CrDgdrKwaqRXEXqgWpQfQVcLeY/w BP5argOsYhjF1cmS0mkvss4bBsfC0AKUjc68EehDlfDbarS7KHTjt5gyqN1HTdPB9TR0 UQUd+fdpbUoEj+dQB2ZfSLb0kw3LenLRzV7Zdb5iN3eIBnqq/9r9CLYLYm6+JkFFPGCc 8Qeg== X-Gm-Message-State: AElRT7GPFljoUc+NaHaJOyVCccmR/WMnD++j7aQtbxXOD4O61sQtbrd2 Xnor5Jr77yxikwwB8bLckt/R8p0W X-Google-Smtp-Source: AG47ELt+mrwj/vjOsZjhPu8l2u4VwGEh0BI9fxen0BkPkdmLTvjBtxXObnInyRDPuUtEBW6hpLkggw== X-Received: by 10.223.139.130 with SMTP id o2mr4900073wra.147.1521296655083; Sat, 17 Mar 2018 07:24:15 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:40 +0000 Message-Id: <20180317142340.11653-23-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 17 Mar 2018 14:24:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 17 Mar 2018 14:24:16 +0000 (UTC) for IP:'209.85.128.193' DOMAIN:'mail-wr0-f193.google.com' HELO:'mail-wr0-f193.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.128.193 mail-wr0-f193.google.com 209.85.128.193 mail-wr0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 22/22] apibuild: Simplify parsing string tokens 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:28:24 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Improve readability and reduce the complexity of the code that is searching for string tokens (i.e. characters surrounded by a single or double quote). Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 24e0eb505..f2971db5b 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -484,28 +484,16 @@ class CLexer: break l =3D len(line) if line[0] =3D=3D '"' or line[0] =3D=3D "'": - end =3D line[0] - line =3D line[1:] - found =3D 0 - tok =3D "" - while found =3D=3D 0: - i =3D 0 - l =3D len(line) - while i < l: - if line[i] =3D=3D end: - self.line =3D line[i+1:] - line =3D line[:i] - l =3D i - found =3D 1 - break - if line[i] =3D=3D '\\': - i =3D i + 1 - i =3D i + 1 - tok =3D tok + line - if found =3D=3D 0: - line =3D self.getline() - if line is None: - return None + quote =3D line[0] + i =3D 1 + while quote not in line[i:]: + i =3D len(line) + nextline =3D self.getline() + if nextline is None: + return None + line +=3D nextline + + tok, self.line =3D line[1:].split(quote, 1) self.last =3D ('string', tok) return self.last =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list