← Back to team overview

openstack team mailing list archive

Re: [Quantum] Ordering of imports

 

Thanks a lot for sharing this information.

Even if HACKING.rst has an example along the same lines, it does not
state clearly that ordering should include also the name of the
module/class being imported.
Quoting LZY's example, I think it might be worth adding something like
the following to HACKING:

from quantum.plugins.cisco.db import models  ==> quantum.plugins.cisco.db.models
from quantum.plugins.cisco.db.models import BASE ==>
quantum.plugins.cisco.db.models.BASE

Salvatore

On 21 June 2012 14:36, Zhongyue Luo <lzyeval@xxxxxxxxx> wrote:
> Hi, stackers
>
> Recently I submitted a patch of re-ordered imports by full module path, as
> stated in HACKING.rst
> https://review.openstack.org/#/c/8666/
>
> The full module path of a import is the absolute path of the module/object
> from its package root.
>
> Therefore, the order of the modules/objects
>
> from quantum.plugins.cisco.db.models import BASE
> from quantum.plugins.cisco.db import models
>
> should be
>
> from quantum.plugins.cisco.db import
> models (quantum.plugins.cisco.db.models)
> from quantum.plugins.cisco.db.models import
> BASE (quantum.plugins.cisco.db.models.BASE)
>
> The re-ordering was done using a tool I wrote.
> https://review.openstack.org/#/c/8592/
>
> Once the tool gets in openstack-common, it will be easier to check the
> import order of your patches before submitting them for review.
>
> Cheers,
> LZY
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>


References