]> xenbits.xensource.com Git - libvirt.git/commitdiff
esx_vi_generator: Simplify alignment function
authorRadostin Stoyanov <rstoyanov1@gmail.com>
Tue, 20 Mar 2018 06:48:51 +0000 (06:48 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 20 Mar 2018 12:13:35 +0000 (12:13 +0000)
Generate whitespace using the standard function ljust() that is
available in both Py3 [1] and Py2 [2].

1: https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.ljust
2: https://docs.python.org/2.7/library/string.html#string.ljust

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
src/esx/esx_vi_generator.py

index df913d89150cf731bb122a65623566f298b67adc..31bd10fb15fe52ba417ea42dd42d16ba85351621 100755 (executable)
@@ -49,10 +49,7 @@ separator = "/* " + ("* " * 37) + "*\n"
 
 
 def aligned(left, right, length=59):
-    while len(left) < length:
-        left += " "
-
-    return left + right
+    return left.ljust(length, ' ') + right