Merge "Fix pylint warnings for "unnecessary not""

This commit is contained in:
Zuul 2018-09-20 19:40:53 +00:00 committed by Gerrit Code Review
commit d79cb53718
8 changed files with 12 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2008,7 +2008,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
host = None host = None
rp = None rp = None
folder = 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 # Pick a datastore where to create the full clone under any host
(host, rp, folder, summary) = self._select_ds_for_volume(volume) (host, rp, folder, summary) = self._select_ds_for_volume(volume)
datastore = summary.datastore datastore = summary.datastore