From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-portage-dev+bounces-3470-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ABF3D138DDC for <garchives@archives.gentoo.org>; Thu, 13 Feb 2014 18:04:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3D446E0B23; Thu, 13 Feb 2014 18:03:52 +0000 (UTC) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 99A27E0B22 for <gentoo-portage-dev@lists.gentoo.org>; Thu, 13 Feb 2014 18:03:51 +0000 (UTC) Received: by mail-vb0-f43.google.com with SMTP id p5so8393882vbn.16 for <gentoo-portage-dev@lists.gentoo.org>; Thu, 13 Feb 2014 10:03:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Psmra6N656pXqHEtnoIqHBAECMRyYXMdDkt1kHTpmSo=; b=IpHPqvsJ5d4ktNBSKrwxQmuTvOJrdSLQqDEgqe7iKKoCm8FIyvJXrda0OC7SJdFJBb qAM82FpZADVKQNNideinFZIPcMHOMb+fA6zfFJe1E1UySq1F1HwdEAiMUZfA7xViACJn d04C60pfmORCYcKLjNWvu/ysV4FR3kn8JEyi69rDvl+oDpH7ezWDa1W57NMTuhNnLJ5p 6UcgR4qB2hzzTKxOHOoa0OuK5iu1sXS+JheBkmHuMGJ1UEZMYvqqbx5IOcMDFOs4rQrf pjYCYpemeoOIsXoRNtumDkbJ4mVr69tiUo8E98kdUDGmak2PTeYSs90LxhmY487zWn4O usNw== X-Gm-Message-State: ALoCoQnTQ5GDaF4c701wNGtHMs9d+H+1T/JzwVIxrgAkGTzB1Qpg7Y5hCHbvIhwL4OvkDSBMnjUY Precedence: bulk List-Post: <mailto:gentoo-portage-dev@lists.gentoo.org> List-Help: <mailto:gentoo-portage-dev+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-portage-dev+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-portage-dev+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-portage-dev.gentoo.org> X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 X-Received: by 10.220.103.141 with SMTP id k13mr1703295vco.25.1392314630801; Thu, 13 Feb 2014 10:03:50 -0800 (PST) Sender: antarus@scriptkitty.com Received: by 10.220.59.71 with HTTP; Thu, 13 Feb 2014 10:03:50 -0800 (PST) X-Originating-IP: [2620:0:1000:2e00:f4fc:4654:1b90:cfb6] In-Reply-To: <20140213074229.529bec4f@big_daddy.dol-sen.ca> 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> Date: Thu, 13 Feb 2014 10:03:50 -0800 X-Google-Sender-Auth: 14O65qtZ8o1qsxoxpXXKVzA3yPM Message-ID: <CAAr7Pr-XGzNg=-9PanwBgG1b2tXr6sAMoCPAZU_sidgMeSDvFg@mail.gmail.com> Subject: Re: [gentoo-portage-dev] [PATCH v2] Add --output-style option to repoman From: Alec Warner <antarus@gentoo.org> To: gentoo-portage-dev@lists.gentoo.org Content-Type: multipart/alternative; boundary=047d7b342d30fc21be04f24d82d6 X-Archives-Salt: e09693d2-7aee-4efe-9ba9-038745afd45f X-Archives-Hash: d4a5c98f609db277418890c4d13e99d1 --047d7b342d30fc21be04f24d82d6 Content-Type: text/plain; charset=UTF-8 On Thu, Feb 13, 2014 at 7:42 AM, Brian Dolbec <dolsen@gentoo.org> wrote: > On Thu, 13 Feb 2014 03:19:35 -0500 > Mike Frysinger <vapier@gentoo.org> 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. > > > > > > > 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 > > > 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. > In general we prefer % for readability purposes, not because it is faster. foo = "Bar" + foo + " " + baz + "," + goat foo = "Bar %s %s, %s" % (foo, baz, goat) I think this case could go either way, because even with %, "NumberOf%s" is not much of an improvement. The code is littered with the former though, and it makes it really annoying to read ;) -A > > > str(number) > > -mike > > > > -- > Brian Dolbec <dolsen> > > --047d7b342d30fc21be04f24d82d6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T= hu, Feb 13, 2014 at 7:42 AM, Brian Dolbec <span dir=3D"ltr"><<a href=3D"= mailto:dolsen@gentoo.org" target=3D"_blank">dolsen@gentoo.org</a>></span= > wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"im">On Thu, 13 Feb 2014 03:19:= 35 -0500<br> Mike Frysinger <<a href=3D"mailto:vapier@gentoo.org">vapier@gentoo.org</= a>> wrote:<br> <br> > On Monday, February 10, 2014 20:22:36 Chris Reffett wrote:<br> > > This patch adds a --output-style option to repoman, which gives t= he<br> > > user a choice of output formats for the repoman checks. Choices a= re<br> > > "default" (current style) and "column" (a gre= ppable format), but it<br> > > should be easy to add more. Fixes bug 481584.<br> ><br> > i'd expect a proper structured output would make sense to include = in<br> > the default set. =C2=A0like JSON. =C2=A0just create a dict and send it= to<br> > json.dump().<br> <br> </div>He is working on more changes to repoman and the output. So, if you<b= r> can, Chris, then do it, add a json option.<br> <div class=3D"im"><br> <br> ><br> > > v2: Fix docstring to be complete and in the standard format, make= <br> > > use of default choices in --output-style wrt comments by antarus<= br> > > and dol-sen<br> ><br> > erm, i thought the previous docstring was correct. =C2=A0it followed<b= r> > PEP257 while this new one is like javadoc or something.<br> ><br> <br> </div>It is the existing format that has been around in portage for years.<= br> There is even a page for it:<br> <br> <a href=3D"http://www.gentoo.org/proj/en/portage/doc/policies/docstring-spe= c.xml" target=3D"_blank">http://www.gentoo.org/proj/en/portage/doc/policies= /docstring-spec.xml</a><br> <br> It is also the style that epydoc recognizes.<br> <div class=3D"im"><br> > > -utilities.format_qa_output(f, stats, fails, dofull, dofail,<br> > > options, qawarnings)<br> > > +if options.output_style =3D=3D 'column':<br> > > + =C2=A0 utilities.format_qa_output_column(f, stats, fails, doful= l,<br> > > dofail, options, qawarnings)<br> > > +else:<br> > > + =C2=A0 utilities.format_qa_output(f, stats, fails, dofull,<br> > > dofail, options, qawarnings)<br> ><br> > use a func pointer instead.<br> > format_outputs =3D {<br> > =C2=A0 =C2=A0 =C2=A0 'column': utilities.format_qa_output_colu= mn,<br> > =C2=A0 =C2=A0 =C2=A0 'default': utilities.format_qa_output,<br= > > }<br> > format_output =3D format_outputs.get(options.output_style,<br> > =C2=A0 =C2=A0 =C2=A0 format_outputs['default'])<br> > format_output(f, stats, fails, dofull, dofail, options, qawarnings)<br= > ><br> <br> </div>yeah, make it so. =C2=A0Good spot, Mike<br> <br> <br> Since Mike was too slow in replying, make another commit to change<br> it.<br> <div class=3D"im"><br> > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 formatter.add_literal_data(&= quot;NumberOf " + category<br> > > + " ")<br> ><br> > prefer to use % rather than + like so:<br> > =C2=A0 =C2=A0 =C2=A0 'NumberOf %s ' % category<br> ><br> > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 formatter.add_literal_data(&= quot;%s" % number)<br> ><br> <br> </div>well actually, for simple additions like that, string1 + string2, it = is<br> actually faster.<br> But for multiple additions, =C2=A0%s is much better, faster. =C2=A0Also if = the<br> string is translated, then use %s regardless. =C2=A0That way the %s can be<= br> moved around for the translation.<br></blockquote><div><br></div><div>In ge= neral we prefer % for readability purposes, not because it is faster.</div>= <div><br></div><div>foo =3D "Bar" + foo + " " + baz + &= quot;," + goat</div> <div><br></div><div>foo =3D "Bar %s %s, %s" % (foo, baz, goat)</d= iv><div><br></div><div>I think this case could go either way, because even = with %, "NumberOf%s" is not much of an improvement.</div><div>The= code is littered with the former though, and it makes it really annoying t= o read ;)</div> <div><br></div><div>-A</div><div><br></div><div>=C2=A0</div><blockquote cla= ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa= dding-left:1ex"> <br> > str(number)<br> > -mike<br> <span class=3D"HOEnZb"><font color=3D"#888888"><br> <br> <br> --<br> Brian Dolbec <dolsen><br> <br> </font></span></blockquote></div><br></div></div> --047d7b342d30fc21be04f24d82d6--