Merge lp:~jtv/maas/for-underscore into lp:~maas-committers/maas/trunk
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2983 |
Proposed branch: | lp:~jtv/maas/for-underscore |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
197 lines (+19/-21) 12 files modified
src/maasserver/api/tests/test_nodes.py (+1/-1) src/maasserver/models/tests/test_components.py (+1/-1) src/maasserver/models/tests/test_dhcplease.py (+2/-2) src/maasserver/models/tests/test_managers.py (+3/-3) src/maasserver/models/tests/test_staticipaddress.py (+1/-1) src/maasserver/models/tests/test_userprofile.py (+2/-2) src/maasserver/rpc/tests/test_regionservice.py (+1/-1) src/maasserver/tests/test_dhcp.py (+2/-2) src/maasserver/views/tests/test_nodes.py (+2/-3) src/maasserver/views/tests/test_prefs.py (+1/-1) src/provisioningserver/drivers/hardware/tests/test_virsh.py (+1/-2) src/provisioningserver/testing/tests/test_bindfixture.py (+2/-2) |
To merge this branch: | bzr merge lp:~jtv/maas/for-underscore |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Review via email: mp+234570@code.launchpad.net |
Commit message
Standardise on “_” for unused loop variables; it's what we use in most places so we might as well have a bit more consistency.
Description of the change
This is another Doris branch. Python doesn't let you write “for” loops without a variable, so we have a lot of loops with single-letter variable names where the variable isn't used, and about twice as many with just an underscore as the unused variable name.
I'm not looking to enforce a rule or anything, but I think we'll get a more harmonious style without the existing mix of ‘i’ and ‘x’ variables.
Most of this is simple mechanical replacement, but there was one case where I used ‘zip’ instead of array indexing; and one case in a test where I replaced a loop to assert equality on list elements with a single equality assertion on the lists. It's a bit fragile for cases where the return value might become a tuple or some other listlike-
Jeroen
review: approve