From 7b973d151edb2b2a83e0730856e4fc39b24069a5 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Wed, 20 Feb 2019 12:01:37 -0500 Subject: [PATCH] Fix pylint R1716 (chained-comparison) refactor messages Use "a < b < c" instead of "a < b and b < c". Change-Id: I1f0c46a609c56ffe869486b25fe6e82faaf3d5fb --- .pylintrc | 1 - neutron/extensions/securitygroup.py | 2 +- neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 79607cf62fa..13b15540751 100644 --- a/.pylintrc +++ b/.pylintrc @@ -87,7 +87,6 @@ disable= too-many-return-statements, too-many-statements, # new for python3 version of pylint - chained-comparison, consider-using-dict-comprehension, consider-using-set-comprehension, unnecessary-pass, diff --git a/neutron/extensions/securitygroup.py b/neutron/extensions/securitygroup.py index 6e72f2e0595..5c905ff52ac 100644 --- a/neutron/extensions/securitygroup.py +++ b/neutron/extensions/securitygroup.py @@ -153,7 +153,7 @@ def convert_protocol(value): return try: val = int(value) - if val >= 0 and val <= 255: + if 0 <= val <= 255: # Set value of protocol number to string due to bug 1381379, # PostgreSQL fails when it tries to compare integer with string, # that exists in db. diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py index 51866e4b00c..6c020bffe46 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -192,7 +192,7 @@ class EmbSwitch(object): # convert the rate_kbps value from kbps to Mbps. # Zero means to disable the rate so the lowest rate available is 1Mbps. # Floating numbers are not allowed - if rate_kbps > 0 and rate_kbps < 1000: + if 0 < rate_kbps < 1000: rate_mbps = 1 else: rate_mbps = helpers.round_val(rate_kbps / 1000.0)