[PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list

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

 



Signed-off-by: Lukas Doktor <ldoktor@xxxxxxxxxx>
---
 client/common_lib/utils.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index f44dd1e..6b8cdf6 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -211,9 +211,14 @@ def matrix_to_string(matrix, header=None):
     in each column, and determining the format string dynamically.
 
     @param matrix: Matrix representation (list with n rows of m elements).
-    @param header: Optional tuple with header elements to be displayed.
+    @param header: Optional tuple or list with header elements to be displayed.
     """
+    if type(header) is list:
+        header = tuple(header)
     lengths = []
+    if header:
+        for column in header:
+            lengths.append(len(column))
     for row in matrix:
         for column in row:
             i = row.index(column)
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux