]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Hyper-V: Remove useless use of "else" clause on for loop
authorAngus Lees <gus@inodes.org>
Thu, 21 Aug 2014 04:08:07 +0000 (14:08 +1000)
committerAngus Lees <gus@inodes.org>
Tue, 21 Oct 2014 22:38:23 +0000 (09:38 +1100)
"else" on for loops is only important if the loop contains a "break"
statement.  Without a "break", the else block is _always_ executed and
it is clearer just to omit "else".

This change also enables the corresponding pylint warning, now that the
only offending case has been fixed.

Change-Id: Ibe8761cb40a7d2d564aa718d62c9f383b5ad711e

.pylintrc
neutron/plugins/ml2/drivers/mech_hyperv.py

index c738c547c1dc78f5b756120906d133c9aa2a534d..ca0b297a6eabf248a5094a1ea6e2a1082ba10515 100644 (file)
--- a/.pylintrc
+++ b/.pylintrc
@@ -68,7 +68,6 @@ disable=
  unused-argument,
  unused-import,
  unused-variable,
- useless-else-on-loop,
 # "C" Coding convention violations
  bad-continuation,
  invalid-name,
index b384d3425ec9ae1e8bee201129bfff7fb4d9a041..ec33c432cb1fa153083c361a1ecc613ae5518f96 100644 (file)
@@ -51,7 +51,4 @@ class HypervMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
             for pattern in mappings:
                 if re.match(pattern, segment[api.PHYSICAL_NETWORK]):
                     return True
-            else:
-                return False
-        else:
-            return False
+        return False