A python keyword is used for a variable name

Bug #1532567 reported by liao_zd@hotmail.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Opinion
Wishlist
Unassigned

Bug Description

horizon/openstack_dashboard/dashboards/project/volumes/volumes/forms.py:

there is a python keyword "type" used for a variable name on line#112, it might be a irrelevant coding style issue, but I think it might be problem in future, or have issue when you write unitest. Besides, this should not be allowed by PEP8 and openstack code style.

Tags: pep8
Changed in horizon:
status: New → In Progress
assignee: nobody → liao_zd@hotmail.com (liao-zd)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/265923

Changed in horizon:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/266447

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/266665

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by <email address hidden> (<email address hidden>) on branch: master
Review: https://review.openstack.org/266447
Reason: I re-commit a new one, this one is abandoned.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by <email address hidden> (<email address hidden>) on branch: master
Review: https://review.openstack.org/265923
Reason: Already commit a new one supersede this.

tags: added: pep8
David Lyle (david-lyle)
Changed in horizon:
importance: Low → Wishlist
Revision history for this message
David Lyle (david-lyle) wrote :

"type" is not actually a python keyword, it is a built-in function which will be overridden for the scope of the method. Since the built-in type function is not called in the method, it currently is not a problem.

Additionally, no PEP8 check should check for this as overriding methods is perfectly allowable in python.

Ideally we would not name variables the same as built-in functions, but in my opinion this is not really a bug, but instead a subjective style issue. Not wrong, but after the fact cleanup provides little benefit. Should the use of "type" in the method change, the fact that "type" is no longer callable will be raised in the form of the exception and at that time the developer requiring type could change the existing variable name.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Liao Zhuodi (<email address hidden>) on branch: master
Review: https://review.openstack.org/266665

Akihiro Motoki (amotoki)
Changed in horizon:
assignee: liao_zd@hotmail.com (liaozd) → nobody
status: In Progress → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.