* [KVM-autotest][patch] matrix_to_string: header columns width
@ 2010-09-29 9:33 Lukas Doktor
2010-09-29 9:33 ` [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list Lukas Doktor
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Doktor @ 2010-09-29 9:33 UTC (permalink / raw)
To: ldoktor, jzupka, autotest, kvm, lmr
Hi,
this patch calculates the columns' width including the header's one. In addition it accepts the header of booth types - tuple or list.
Regards,
Lukas
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list
2010-09-29 9:33 [KVM-autotest][patch] matrix_to_string: header columns width Lukas Doktor
@ 2010-09-29 9:33 ` Lukas Doktor
2010-09-29 11:02 ` Lucas Meneghel Rodrigues
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Doktor @ 2010-09-29 9:33 UTC (permalink / raw)
To: ldoktor, jzupka, autotest, kvm, lmr
Signed-off-by: Lukas Doktor <ldoktor@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list
2010-09-29 9:33 ` [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list Lukas Doktor
@ 2010-09-29 11:02 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 3+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-09-29 11:02 UTC (permalink / raw)
To: Lukas Doktor; +Cc: jzupka, autotest, kvm
On Wed, 2010-09-29 at 11:33 +0200, Lukas Doktor wrote:
> Signed-off-by: Lukas Doktor <ldoktor@redhat.com>
Ooops, my bad, I forgot about the header. Looks good to me, applied,
thanks!
http://autotest.kernel.org/changeset/4818
Lucas
> ---
> 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-29 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 9:33 [KVM-autotest][patch] matrix_to_string: header columns width Lukas Doktor
2010-09-29 9:33 ` [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list Lukas Doktor
2010-09-29 11:02 ` Lucas Meneghel Rodrigues
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.