From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 14A0C138D29 for ; Fri, 14 Feb 2014 18:20:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CCC08E09BF; Fri, 14 Feb 2014 18:20:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4040CE09B7 for ; Fri, 14 Feb 2014 18:20:17 +0000 (UTC) Received: from [127.0.0.1] (SSID-MASON-SECURE-219.wireless.gmu.edu [192.5.215.219]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: creffett) by smtp.gentoo.org (Postfix) with ESMTPSA id 0314933F809 for ; Fri, 14 Feb 2014 18:20:15 +0000 (UTC) Message-ID: <52FE5E53.50604@gentoo.org> Date: Fri, 14 Feb 2014 13:20:03 -0500 From: Chris Reffett User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH v2] Add --output-style option to repoman References: <1392073046-31955-1-git-send-email-creffett@gentoo.org> <1392081756-21088-1-git-send-email-creffett@gentoo.org> <2514424.8cm9mSHptd@vapier> <20140213074229.529bec4f@big_daddy.dol-sen.ca> In-Reply-To: <20140213074229.529bec4f@big_daddy.dol-sen.ca> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: 3f5ff34a-114a-4ec7-a495-d242d4d6bbf6 X-Archives-Hash: 22aa6e458437ffc9dcbcd563aaeb44a4 On 2/13/2014 10:42 AM, Brian Dolbec wrote: > On Thu, 13 Feb 2014 03:19:35 -0500 > Mike Frysinger wrote: > >> On Monday, February 10, 2014 20:22:36 Chris Reffett wrote: >>> This patch adds a --output-style option to repoman, which gives the >>> user a choice of output formats for the repoman checks. Choices are >>> "default" (current style) and "column" (a greppable format), but it >>> should be easy to add more. Fixes bug 481584. >> >> i'd expect a proper structured output would make sense to include in >> the default set. like JSON. just create a dict and send it to >> json.dump(). > > He is working on more changes to repoman and the output. So, if you > can, Chris, then do it, add a json option. > Sure, I'll take a crack at this. > >> >>> v2: Fix docstring to be complete and in the standard format, make >>> use of default choices in --output-style wrt comments by antarus >>> and dol-sen >> >> erm, i thought the previous docstring was correct. it followed >> PEP257 while this new one is like javadoc or something. >> > > It is the existing format that has been around in portage for years. > There is even a page for it: > > http://www.gentoo.org/proj/en/portage/doc/policies/docstring-spec.xml > > It is also the style that epydoc recognizes. > >>> -utilities.format_qa_output(f, stats, fails, dofull, dofail, >>> options, qawarnings) >>> +if options.output_style == 'column': >>> + utilities.format_qa_output_column(f, stats, fails, dofull, >>> dofail, options, qawarnings) >>> +else: >>> + utilities.format_qa_output(f, stats, fails, dofull, >>> dofail, options, qawarnings) >> >> use a func pointer instead. >> format_outputs = { >> 'column': utilities.format_qa_output_column, >> 'default': utilities.format_qa_output, >> } >> format_output = format_outputs.get(options.output_style, >> format_outputs['default']) >> format_output(f, stats, fails, dofull, dofail, options, qawarnings) >> > > yeah, make it so. Good spot, Mike > Will make this change when I'm back at my devbox (probably Mondayish). > > Since Mike was too slow in replying, make another commit to change > it. > >>> + formatter.add_literal_data("NumberOf " + category >>> + " ") >> >> prefer to use % rather than + like so: >> 'NumberOf %s ' % category >> >>> + formatter.add_literal_data("%s" % number) >> > > well actually, for simple additions like that, string1 + string2, it is > actually faster. > But for multiple additions, %s is much better, faster. Also if the > string is translated, then use %s regardless. That way the %s can be > moved around for the translation. > >> str(number) >> -mike > > >