Re: [openstack-dev] [solum] pep8 - splitting expressions
On Thu, 2014-09-11 at 18:35 -0500, Ed Leafe wrote: > On Sep 11, 2014, at 5:05 PM, Kevin L. Mitchell > wrote: > > > 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. > > When not using visual indentation, the standard is to indent two > levels (i.e., 8 spaces), to distinguish it from typical blocks. But > yes, I much prefer this than creating temporary names to accommodate > the visual indentation style. Using an 8 space indent here would result in an E126 pep8 error, which is why I use 4 spaces for this case. Of course, I don't know if Solum enforces E126. -- Kevin L. Mitchell Rackspace ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [solum] pep8 - splitting expressions
On Sep 11, 2014, at 5:05 PM, Kevin L. Mitchell wrote: > 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. When not using visual indentation, the standard is to indent two levels (i.e., 8 spaces), to distinguish it from typical blocks. But yes, I much prefer this than creating temporary names to accommodate the visual indentation style. -- Ed Leafe signature.asc Description: Message signed with OpenPGP using GPGMail ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [solum] pep8 - splitting expressions
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 Rackspace ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [solum] pep8 - splitting expressions
On 09/09/2014 03:05 PM, 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) The line that assigns a value to 'parameter_definitions_uri' is (as you might be able to tell) too long. What is the best way to split this expression up? pdu = common.ASSEM_PARAM_STR % pecan.request.host_url 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=pdu) Best, -jay ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [solum] pep8 - splitting expressions
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) The line that assigns a value to 'parameter_definitions_uri' is (as you might be able to tell) too long. What is the best way to split this expression up? ~ gp___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev