From 105ce10838ccf20a41ece32997e0cf8ffb1de483 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Thu, 21 Aug 2014 14:08:07 +1000 Subject: [PATCH] Hyper-V: Remove useless use of "else" clause on for loop "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 | 1 - neutron/plugins/ml2/drivers/mech_hyperv.py | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index c738c547c..ca0b297a6 100644 --- 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, diff --git a/neutron/plugins/ml2/drivers/mech_hyperv.py b/neutron/plugins/ml2/drivers/mech_hyperv.py index b384d3425..ec33c432c 100644 --- a/neutron/plugins/ml2/drivers/mech_hyperv.py +++ b/neutron/plugins/ml2/drivers/mech_hyperv.py @@ -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 -- 2.45.2