Browse Source

Fix pylint R1716 (chained-comparison) refactor messages

Use "a < b < c" instead of "a < b and b < c".

Change-Id: I1f0c46a609c56ffe869486b25fe6e82faaf3d5fb
changes/04/638304/6
Brian Haley 3 years ago
parent
commit
7b973d151e
  1. 1
      .pylintrc
  2. 2
      neutron/extensions/securitygroup.py
  3. 2
      neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py

1
.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,

2
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.

2
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)

Loading…
Cancel
Save