esx_vi_generator: Simplify generate_helper_source

The generate_helper_source() function returns a formatted string.
This could be achieved without the use of a local variable "source"
and string concatenation.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov 2018-03-20 06:48:48 +00:00 committed by Daniel P. Berrangé
parent 293bb82b58
commit 68106955da
1 changed files with 12 additions and 19 deletions

View File

@ -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):