[openstack-dev] [solum] pep8 - splitting expressions

Kevin L. Mitchell kevin.mitchell at rackspace.com
Thu Sep 11 22:05:47 UTC 2014


On Tue, 2014-09-09 at 12:05 -0700, Gilbert Pilz wrote:
> I have a question with regards to splitting expressions in order to
> conform to the pep8 line-length restriction. I have the following bit
> of code:
> 
> 
>             res = amodel.Assemblies(uri=common.ASSEM_URI_STR %
>                                     pecan.request.host_url,
>                                     name='Solum_CAMP_assemblies',
>                                     type='assemblies',
>                                     description=common.ASSEM_DESC_STR,
>                                     assembly_links=a_links,
>                                     parameter_definitions_uri=common.ASSEM_PARAM_STR %
>                                     pecan.request.host_url)

I'd suggest trying:

        res = amodel.Assemblies(
            uri=common.ASSEM_URI_STR % pecan.request.host_url,
            name='Solum_CAMP_assemblies',
            type='assemblies',
            description=common.ASSEM_DESC_STR,
            assembly_links=a_links,
            parameter_definitions_uri=common.ASSEM_PARAM_STR %
            pecan.request.host_url)

By moving the first argument to a line by itself, pep8 can be satisfied
by indenting the following lines by 4 spaces.
-- 
Kevin L. Mitchell <kevin.mitchell at rackspace.com>
Rackspace




More information about the OpenStack-dev mailing list