From nobody Sat Jul 5 15:57:46 2025 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