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 <rstoyanov1(a)gmail.com>
---
src/esx/esx_vi_generator.py | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 17ac43cb7..8f581c41e 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -1092,26 +1092,19 @@ class ManagedObject(GenericObject):
def generate_helper_source(self):
- source = ""
-
# lookup
- source += "/* esxVI_Lookup%s */\n" % self.name
- source += "ESX_VI__TEMPLATE__LOOKUP(%s,\n" % self.name
- source += "{\n"
-
- source += self.generate_lookup_code1()
-
- source += "},\n"
- source += "{\n"
-
- source += self.generate_lookup_code2()
-
- source += "})\n\n"
-
- source += "\n\n"
-
- return source
-
+ return (
+ "/* esxVI_Lookup%(name)s */\n"
+ "ESX_VI__TEMPLATE__LOOKUP(%(name)s,\n"
+ "{\n"
+ "%(lookup_code1)s},\n"
+ "{\n"
+ "%(lookup_code2)s})"
+ "\n\n\n\n"
+ % {"name": self.name,
+ "lookup_code1": self.generate_lookup_code1(),
+ "lookup_code2": self.generate_lookup_code2()}
+ )
class Enum(Type):
--
2.14.3