1 |
On Thu, 13 Feb 2014 03:19:35 -0500 |
2 |
Mike Frysinger <vapier@g.o> wrote: |
3 |
|
4 |
> On Monday, February 10, 2014 20:22:36 Chris Reffett wrote: |
5 |
> > This patch adds a --output-style option to repoman, which gives the |
6 |
> > user a choice of output formats for the repoman checks. Choices are |
7 |
> > "default" (current style) and "column" (a greppable format), but it |
8 |
> > should be easy to add more. Fixes bug 481584. |
9 |
> |
10 |
> i'd expect a proper structured output would make sense to include in |
11 |
> the default set. like JSON. just create a dict and send it to |
12 |
> json.dump(). |
13 |
|
14 |
He is working on more changes to repoman and the output. So, if you |
15 |
can, Chris, then do it, add a json option. |
16 |
|
17 |
|
18 |
> |
19 |
> > v2: Fix docstring to be complete and in the standard format, make |
20 |
> > use of default choices in --output-style wrt comments by antarus |
21 |
> > and dol-sen |
22 |
> |
23 |
> erm, i thought the previous docstring was correct. it followed |
24 |
> PEP257 while this new one is like javadoc or something. |
25 |
> |
26 |
|
27 |
It is the existing format that has been around in portage for years. |
28 |
There is even a page for it: |
29 |
|
30 |
http://www.gentoo.org/proj/en/portage/doc/policies/docstring-spec.xml |
31 |
|
32 |
It is also the style that epydoc recognizes. |
33 |
|
34 |
> > -utilities.format_qa_output(f, stats, fails, dofull, dofail, |
35 |
> > options, qawarnings) |
36 |
> > +if options.output_style == 'column': |
37 |
> > + utilities.format_qa_output_column(f, stats, fails, dofull, |
38 |
> > dofail, options, qawarnings) |
39 |
> > +else: |
40 |
> > + utilities.format_qa_output(f, stats, fails, dofull, |
41 |
> > dofail, options, qawarnings) |
42 |
> |
43 |
> use a func pointer instead. |
44 |
> format_outputs = { |
45 |
> 'column': utilities.format_qa_output_column, |
46 |
> 'default': utilities.format_qa_output, |
47 |
> } |
48 |
> format_output = format_outputs.get(options.output_style, |
49 |
> format_outputs['default']) |
50 |
> format_output(f, stats, fails, dofull, dofail, options, qawarnings) |
51 |
> |
52 |
|
53 |
yeah, make it so. Good spot, Mike |
54 |
|
55 |
|
56 |
Since Mike was too slow in replying, make another commit to change |
57 |
it. |
58 |
|
59 |
> > + formatter.add_literal_data("NumberOf " + category |
60 |
> > + " ") |
61 |
> |
62 |
> prefer to use % rather than + like so: |
63 |
> 'NumberOf %s ' % category |
64 |
> |
65 |
> > + formatter.add_literal_data("%s" % number) |
66 |
> |
67 |
|
68 |
well actually, for simple additions like that, string1 + string2, it is |
69 |
actually faster. |
70 |
But for multiple additions, %s is much better, faster. Also if the |
71 |
string is translated, then use %s regardless. That way the %s can be |
72 |
moved around for the translation. |
73 |
|
74 |
> str(number) |
75 |
> -mike |
76 |
|
77 |
|
78 |
|
79 |
-- |
80 |
Brian Dolbec <dolsen> |