[libvirt] [PATCH 08/22] esx_vi_generator: Simplify alignment function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx>
---
 src/esx/esx_vi_generator.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index e4890c61b..0dca44fed 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
 
 
 
-- 
2.14.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux