<div dir="ltr"><div>I'll fix that dict and look through the others. the PEP8 tool does complain about it.<br><br></div>So, so, so. Fedora ships an old version and this is a known bug in the version fedora ships. I just manually upraded via pip and now this does not show up as an error. doh!<br>
<br>So this is completely my bad. I'll take a look for changes like this and revert them.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 23, 2013 at 11:38 AM, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 07/23/2013 07:46 AM, Dylan Baker wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'll look through for the parens, It might be in a seperate patch, but I<br>
think it deserves to be here, since PEP8 is all about readability.<br>
</blockquote>
<br></div>
If you want to defer the parens to a separate patch, that's ok. But, in this<br>
patch we shouldn't commit this atrocious dict. It's really unreadable.<div class="im"><br>
<br>
>>> + return 'GLES{0}.{1}'.format(ones, tenths), {'kind': 'GLES',<br>
>>> + 'gl_10x_version':<br>
>>> + 10 * ones + tenths}<br>
<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><div class="im">
The final one it complained about, but after reading PEP8 again I<br>
understand why, and can fix it. In this case it wants something like this:<br>
variable = {<br>
key: value,<br>
key: value<br>
}<br>
<br>
With the important note that the closing brace (or parentheses or bracket)<br>
should either be on the last line of text, or should be on the next line<br>
even with the indent of the first line.<br>
</div></blockquote>
<br>
Strange. PEP8 says<br>
<br>
--- -8<- ---<br>
The closing brace/bracket/parenthesis on multi-line constructs may either line up under the first non-whitespace character of the last line of list, as in:<br>
<br>
my_list = [<br>
1, 2, 3,<br>
4, 5, 6,<br>
]<br>
result = some_function_that_takes_<u></u>arguments(<br>
'a', 'b', 'c',<br>
'd', 'e', 'f',<br>
)<br>
or it may be lined up under the first character of the line that starts the multi-line construct, as in:<br>
<br>
my_list = [<br>
1, 2, 3,<br>
4, 5, 6,<br>
]<br>
result = some_function_that_takes_<u></u>arguments(<br>
'a', 'b', 'c',<br>
'd', 'e', 'f',<br>
)<br>
--- >8- ---<br>
<br>
So, the tool should not have complained about<br>
<br>
my_dict = {<br>
k1: v1,<br>
k2: v2,<br>
}<br>
<br>
Anyways, if the pep8 tool does incorrectly complain about that dict,<br>
then go ahead and fix it. I'm just concerned that, even if I take<br>
pains to code according to PEP8, then the tool will still loudly<br>
complain.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Mon, Jul 22, 2013 at 2:26 PM, Chad Versace<br>
<<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>><u></u>wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 07/10/2013 03:19 PM, Dylan Baker wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
There are a 3 lines that are just over the recommended 79 character<br>
limit, however, breaking them made them harder to read so they were<br>
left.<br>
---<br></div>
glapi/parse_glspec.py | 76 ++++++++++++++++++++++++------<u></u>**<div class="im"><br>
---------------------<br>
1 file changed, 36 insertions(+), 40 deletions(-)<br>
<br>
</div></blockquote>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
m = GLES_VERSION_REGEXP.match(**<u></u>category_name)<div><div class="h5"><br>
if m:<br>
ones = int(m.group(1))<br>
tenths = int(m.group(2))<br>
- return 'GLES{0}.{1}'.format(ones, tenths), {<br>
- 'kind': 'GLES',<br>
- 'gl_10x_version': 10 * ones + tenths<br>
- }<br>
+ return 'GLES{0}.{1}'.format(ones, tenths), {'kind': 'GLES',<br>
+ 'gl_10x_version':<br>
+ 10 * ones + tenths}<br>
<br>
<br>
</div></div></blockquote><div><div class="h5">
<br>
The original was significantly more readable. Maybe you could achieve PEP-8<br>
correctness while maintaining readability by using explicit parens around<br>
the<br>
tuple. Maybe like this:<br>
<br>
return ('GLES{0}.{1}'.format(ones, tenths),<br>
{'kind': 'GLES',<br>
'gl_10x_version': 10 * ones + tenths})<br>
<br>
or this<br>
<br>
return (<br>
<br>
'GLES{0}.{1}'.format(ones, tenths),<br>
{'kind': 'GLES',<br>
'gl_10x_version': 10 * ones + tenths}<br>
)<br>
<br>
From my interpretation of the PEP8 doc, both are PEP8 correct.<br>
<br>
<br>
<br>
<br>
extension_name = 'GL_' + category_name<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- return extension_name, {<br>
- 'kind': 'extension',<br>
- 'extension_name': extension_name<br>
- }<br>
+ return extension_name, {'kind': 'extension',<br>
+ 'extension_name': extension_name}<br>
<br>
</blockquote>
<br>
<br>
While your changing the formatting of tuples, could you add explicit<br>
parens to aid readability? There are several other locations in this<br>
patch where parens could be added. Or do you think that belongs to<br>
a separate patch?<br>
<br>
<br>
<br>
<br>
if name not in self.functions:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- self.functions[name] = {<br>
- 'return_type': return_type,<br>
- 'param_names': param_names,<br>
- 'param_types': param_types,<br>
- 'categories': [category],<br>
- }<br>
+ self.functions[name] = {'return_type': return_type,<br>
+ 'param_names': param_names,<br>
+ 'param_types': param_types,<br>
+ 'categories': [category]}<br>
<br>
</blockquote>
<br>
Did the PEP8 tool complain about this one?<br>
<br>
<br>
</div></div></blockquote>
<br>
</blockquote>
<br>
</blockquote></div><br></div>