summaryrefslogtreecommitdiff
path: root/generator.py
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2020-04-19 15:55:12 +0200
committerJano Tomko <jtomko@redhat.com>2020-09-01 13:26:01 +0000
commit879dae7483bb955f421eea6b1d6d4f32f4f8abd0 (patch)
tree0efa2887b64d0e283bb4452e208989a767f1c32c /generator.py
parent928f5a22e6865e47bc8d8288d295115114966330 (diff)
downloadlibvirt-python-879dae7483bb955f421eea6b1d6d4f32f4f8abd0.tar.gz
generator: Use more string formatting
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/generator.py b/generator.py
index 088ccb7..0e7e02c 100755
--- a/generator.py
+++ b/generator.py
@@ -1541,13 +1541,10 @@ def buildWrappers(module):
# contents of functions_int_*:
elif is_integral_type(ret[0]):
if name not in functions_noexcept:
- if name in functions_int_exception_test:
- test = functions_int_exception_test[name]
- else:
- test = functions_int_default_test
- classes.write((" if " + test +
- ": raise libvirtError ('%s() failed')\n") %
- ("ret", name))
+ test = functions_int_exception_test.get(name, functions_int_default_test) % ("ret",)
+ classes.write(
+ " if %s: raise libvirtError ('%s() failed')\n" %
+ (test, name))
classes.write(" return ret\n")
elif is_python_noninteger_type(ret[0]):