1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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

View File

@ -1092,26 +1092,19 @@ class ManagedObject(GenericObject):
def generate_helper_source(self): def generate_helper_source(self):
source = ""
# lookup # lookup
source += "/* esxVI_Lookup%s */\n" % self.name return (
source += "ESX_VI__TEMPLATE__LOOKUP(%s,\n" % self.name "/* esxVI_Lookup%(name)s */\n"
source += "{\n" "ESX_VI__TEMPLATE__LOOKUP(%(name)s,\n"
"{\n"
source += self.generate_lookup_code1() "%(lookup_code1)s},\n"
"{\n"
source += "},\n" "%(lookup_code2)s})"
source += "{\n" "\n\n\n\n"
% {"name": self.name,
source += self.generate_lookup_code2() "lookup_code1": self.generate_lookup_code1(),
"lookup_code2": self.generate_lookup_code2()}
source += "})\n\n" )
source += "\n\n"
return source
class Enum(Type): class Enum(Type):