Fix pylint warnings for "unnecessary not"

Fix boolean expressions that creates an unnecessary negation.

Change-Id: Ib17693a426107949488b920a19fa3d13398ee897
Signed-off-by: Chuck Short <chucks@redhat.com>
This commit is contained in:
Chuck Short 2018-09-10 12:30:53 -04:00
parent c369493e87
commit 7c50366f49
8 changed files with 12 additions and 13 deletions

View File

@ -144,7 +144,6 @@ disable=
unused-variable,
len-as-condition,
cell-var-from-loop,
unneeded-not,
singleton-comparison,
misplaced-comparison-constant,
unidiomatic-typecheck,

View File

@ -81,7 +81,7 @@ def _time_error(LOG, begin, end):
"%Y-%m-%d %H:%M:%S")
begin = begin.replace(tzinfo=iso8601.UTC)
end = end.replace(tzinfo=iso8601.UTC)
if not end > begin:
if end <= begin:
msg = _("The end time (%(end)s) must be after the start "
"time (%(start)s).") % {'start': begin,
'end': end}

View File

@ -675,7 +675,7 @@ class DateraApi(object):
TIMEOUT = 10
retry = 0
poll = True
while poll and not retry >= TIMEOUT:
while poll and retry < TIMEOUT:
retry += 1
snap = self._issue_api_request(url, api_version='2')
if snap['op_state'] == 'available':
@ -695,7 +695,7 @@ class DateraApi(object):
policies['default_storage_name']).format(
datc._get_name(volume['id']))
poll = True
while poll and not retry >= TIMEOUT:
while poll and retry < TIMEOUT:
retry += 1
si = self._issue_api_request(check_url, api_version='2')
if si['op_state'] == 'available':

View File

@ -800,7 +800,7 @@ class DateraApi(object):
TIMEOUT = 20
retry = 0
poll = True
while poll and not retry >= TIMEOUT:
while poll and retry < TIMEOUT:
retry += 1
snap = self._issue_api_request(url,
api_version='2.1',
@ -822,7 +822,7 @@ class DateraApi(object):
policies['default_storage_name']).format(
datc._get_name(volume['id']))
poll = True
while poll and not retry >= TIMEOUT:
while poll and retry < TIMEOUT:
retry += 1
si = self._issue_api_request(check_url,
api_version='2.1',

View File

@ -199,7 +199,7 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
"target_ip_address '%s.'",
(", ".join(temp_iscsi_ip)))
if not len(iscsi_ip_list) > 0:
if not len(iscsi_ip_list):
msg = _('At least one valid iSCSI IP address must be set.')
LOG.error(msg)
raise exception.InvalidInput(reason=msg)

View File

@ -481,7 +481,7 @@ class FlashSystemDriver(san.SanDriver,
# Get storage system name and id
ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']
attributes = self._execute_command_and_parse_attributes(ssh_cmd)
if not attributes or not ('name' in attributes):
if not attributes or ('name' not in attributes):
msg = _('Could not get system name.')
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
@ -490,7 +490,7 @@ class FlashSystemDriver(san.SanDriver,
# Validate value of open_access_enabled flag, for now only
# support when open_access_enabled is off
if not attributes or not ('open_access_enabled' in attributes) or (
if not attributes or ('open_access_enabled' not in attributes) or (
attributes['open_access_enabled'] != 'off'):
msg = _('open_access_enabled is not off.')
LOG.error(msg)
@ -504,7 +504,7 @@ class FlashSystemDriver(san.SanDriver,
msg = _('Unable to parse attributes.')
LOG.error(msg)
raise exception.InvalidInput(reason=msg)
if not ('status' in attributes) or (
if ('status' not in attributes) or (
attributes['status'] == 'offline'):
msg = (_('Array does not exist or is offline. '
'Current status of array is %s.')

View File

@ -445,7 +445,7 @@ class GPFSDriver(driver.CloneableImageVD,
raise exception.VolumeBackendAPIException(data=msg)
_gpfs_cluster_release_level = self._get_gpfs_cluster_release_level()
if not _gpfs_cluster_release_level >= GPFS_CLONE_MIN_RELEASE:
if _gpfs_cluster_release_level < GPFS_CLONE_MIN_RELEASE:
msg = (_('Downlevel GPFS Cluster Detected. GPFS Clone feature '
'not enabled in cluster daemon level %(cur)s - must '
'be at least at level %(min)s.') %
@ -474,7 +474,7 @@ class GPFSDriver(driver.CloneableImageVD,
filesystem, fslevel = \
self._get_gpfs_fs_release_level(directory)
if not fslevel >= GPFS_CLONE_MIN_RELEASE:
if fslevel < GPFS_CLONE_MIN_RELEASE:
msg = (_('The GPFS filesystem %(fs)s is not at the required '
'release level. Current level is %(cur)s, must be '
'at least %(min)s.') %

View File

@ -2008,7 +2008,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
host = None
rp = None
folder = None
if not clone_type == volumeops.LINKED_CLONE_TYPE:
if clone_type != volumeops.LINKED_CLONE_TYPE:
# Pick a datastore where to create the full clone under any host
(host, rp, folder, summary) = self._select_ds_for_volume(volume)
datastore = summary.datastore