From 25409b2dd3478a138cd9ae81bd584d49ac1e2e01 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 20 Mar 2018 06:48:49 +0000 Subject: [PATCH] esx_vi_generator: Simplify generate_helper_header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function generate_helper_header() only returns a formatted string. This could be achieved without performing string concatenation. Reviewed-by: Daniel P. Berrangé Signed-off-by: Radostin Stoyanov --- src/esx/esx_vi_generator.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 8f581c41e2..95521fa1e5 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1021,20 +1021,16 @@ class ManagedObject(GenericObject): def generate_helper_header(self): - header = "" - # functions - header += ("int esxVI_Lookup%s(esxVI_Context *ctx, " - "const char *name, " - "esxVI_ManagedObjectReference *root, " - "esxVI_String *selectedPropertyNameList, " - "esxVI_%s **item, " - "esxVI_Occurrence occurrence);\n") \ - % (self.name, self.name) - - header += "\n" - - return header + return ( + "int esxVI_Lookup%(name)s(esxVI_Context *ctx," + " const char *name," + " esxVI_ManagedObjectReference *root," + " esxVI_String *selectedPropertyNameList," + " esxVI_%(name)s **item," + " esxVI_Occurrence occurrence);\n\n" + % {"name": self.name} + ) def generate_source(self): -- GitLab