提交 68106955 编写于 作者: R Radostin Stoyanov 提交者: Daniel P. Berrangé

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: NDaniel P. Berrangé <berrange@redhat.com>
Signed-off-by: NRadostin Stoyanov <rstoyanov1@gmail.com>
上级 293bb82b
......@@ -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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册