[Piglit] [PATCH v3 20/29] parse_glspec.py: PEP8 compliance

Chad Versace chad.versace at linux.intel.com
Mon Jul 29 11:14:03 PDT 2013


On 07/24/2013 02:57 PM, Dylan Baker wrote:
> There are a 3 lines that are just over the recommended 79 character
> limit, however, breaking them made them harder to read so they were
> left.
>
> v2: - Add explicit parens to return statements
>      - Change the formatting of one dictionary definition to be closer to
>        the original, per Chad
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>   glapi/parse_glspec.py | 71 ++++++++++++++++++++++++---------------------------
>   1 file changed, 34 insertions(+), 37 deletions(-)



> @@ -181,34 +181,30 @@ def filter_comments(f):
>   #
>   # - "VERSION_2_1" is converted into { 'kind': 'GL', 'gl_10x_version': 21 }
>   #
> -# - "ARB_foo" is converted into { 'kind': 'extension', 'extension_name': 'GL_ARB_foo' }
> +# - "ARB_foo" is converted into:
> +#   { 'kind': 'extension', 'extension_name': 'GL_ARB_foo' }
>   #
> -# - "GL_ES_VERSION_2_0" is converted into { 'kind': 'GLES', 'gl_10x_version': 20 }
> +# - "GL_ES_VERSION_2_0" is converted into:
> +#     { 'kind': 'GLES', 'gl_10x_version': 20 }
>   #   (this category is a piglit extension for local-gl.spec)
>   def translate_category(category_name):
>       m = GL_VERSION_REGEXP.match(category_name)
>       if m:
>           ones = int(m.group(1))
>           tenths = int(m.group(2))
> -        return '{0}.{1}'.format(ones, tenths), {
> -            'kind': 'GL',
> -            'gl_10x_version': 10 * ones + tenths
> -            }
> +        return('{0}.{1}'.format(ones, tenths),
> +               {'kind': 'GL', 'gl_10x_version': 10 * ones + tenths})

This patch looks good except for one thing. A space should follow 'return'.

>       m = GLES_VERSION_REGEXP.match(category_name)
>       if m:
>           ones = int(m.group(1))
>           tenths = int(m.group(2))
> -        return 'GLES{0}.{1}'.format(ones, tenths), {
> -            'kind': 'GLES',
> -            'gl_10x_version': 10 * ones + tenths
> -            }
> +        return('GLES{0}.{1}'.format(ones, tenths),
> +               {'kind': 'GLES', 'gl_10x_version': 10 * ones + tenths})

Here too.

>       extension_name = 'GL_' + category_name
> -    return extension_name, {
> -        'kind': 'extension',
> -        'extension_name': extension_name
> -        }
> +    return(extension_name,
> +           {'kind': 'extension', 'extension_name': extension_name})


And here.


More information about the Piglit mailing list