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:
parent
293bb82b58
commit
68106955da
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user