From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: Re: [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list Date: Wed, 29 Sep 2010 08:02:01 -0300 Message-ID: <1285758121.2505.6.camel@freedom> References: <1285752794-17191-1-git-send-email-ldoktor@redhat.com> <1285752794-17191-2-git-send-email-ldoktor@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: jzupka@redhat.com, autotest@test.kernel.org, kvm@vger.kernel.org To: Lukas Doktor Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28385 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752340Ab0I2LCG (ORCPT ); Wed, 29 Sep 2010 07:02:06 -0400 In-Reply-To: <1285752794-17191-2-git-send-email-ldoktor@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2010-09-29 at 11:33 +0200, Lukas Doktor wrote: > Signed-off-by: Lukas Doktor 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)