From: Radostin Stoyanov Date: Tue, 20 Mar 2018 06:48:51 +0000 (+0000) Subject: esx_vi_generator: Simplify alignment function X-Git-Tag: v4.2.0-rc1~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3a99869ff0b2679079aa26a5dfd1e62272b1318;p=thirdparty%2Flibvirt.git esx_vi_generator: Simplify alignment function 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é Signed-off-by: Radostin Stoyanov --- diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index df913d8915..31bd10fb15 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -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