Fixing Pep8 errors of type E702,E711,E712,E713 & E714

Change-Id: If6d27de86d68b77126aeaf5a2793f592a647e8a4
Story: 2002888
Task: 23097
Signed-off-by: Mathieu Robinson <mathieu.robinson@windriver.com>
Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
Mathieu Robinson 2018-06-26 10:40:33 -04:00 committed by Jack Ding
parent f4ce1b66c0
commit 55becc338b
10 changed files with 18 additions and 17 deletions

View File

@ -158,7 +158,9 @@ class NodeOperator(object):
match = re_processor.search(line)
if match:
cpu = int(match.group(1))
socket_id = -1; core_id = -1; thread_id = -1
socket_id = -1
core_id = -1
thread_id = -1
self.num_cpus += 1
continue

View File

@ -129,13 +129,13 @@ class EventLog(base.APIBase):
def _getEventType(alarms=False, logs=False):
if alarms == False and logs == False:
if alarms is False and logs is False:
return "ALL"
if alarms == True and logs == True:
if alarms is True and logs is True:
return "ALL"
if logs == True:
if logs is True:
return "LOG"
if alarms == True:
if alarms is True:
return "ALARM"
return "ALL"

View File

@ -1350,8 +1350,7 @@ class HostController(rest.RestController):
delta, changed_paths,
current_ihosts)
if (not 'capabilities' in ihost_dict) \
or not ihost_dict['capabilities']:
if ('capabilities' not in ihost_dict or not ihost_dict['capabilities']):
ihost_dict['capabilities'] = {}
# If this is the first controller being set up,

View File

@ -703,7 +703,7 @@ def _set_defaults(interface):
def _check_interface_vlan_id(op, interface, ihost, from_profile=False):
# Check vlan_id
if 'vlan_id' in interface.keys() and interface['vlan_id'] != None:
if 'vlan_id' in interface.keys() and interface['vlan_id'] is not None:
if not str(interface['vlan_id']).isdigit():
raise wsme.exc.ClientSideError(_("VLAN id is an integer value."))
elif not from_profile:
@ -788,7 +788,7 @@ def _check_interface_name(op, interface, ihost, from_profile=False):
def _check_interface_mtu(interface, ihost, from_profile=False):
# Check imtu
if 'imtu' in interface.keys() and interface['imtu'] != None:
if 'imtu' in interface.keys() and interface['imtu'] is not None:
if not str(interface['imtu']).isdigit():
raise wsme.exc.ClientSideError(_("MTU is an integer value."))
elif not from_profile and ihost['recordtype'] != 'profile':
@ -1376,7 +1376,7 @@ def _check_interface_data(op, interface, ihost, existing_interface):
elif (constants.NETWORK_TYPE_NONE not in networktypelist and constants.NETWORK_TYPE_DATA not in networktypelist and
constants.NETWORK_TYPE_DATA not in existing_networktypelist):
if providernetworks != None:
if providernetworks is not None:
msg = _("Provider network(s) not supported "
"for non-data interfaces. (%s) (%s)" % (str(networktypelist), str(existing_interface)))
raise wsme.exc.ClientSideError(msg)
@ -1427,7 +1427,7 @@ def _check_interface_data(op, interface, ihost, existing_interface):
if constants.NETWORK_TYPE_INFRA in hi_networktypelist:
infra_on_controller = True
break
if infra_on_controller == True:
if infra_on_controller is True:
break
if not infra_on_controller:
msg = _("Interface %s does not have associated"

View File

@ -110,7 +110,7 @@ class Service(base.APIBase):
def _check_service_data(op, service):
# Get data
name = service['name']
if not name in constants.ALL_OPTIONAL_SERVICES:
if name not in constants.ALL_OPTIONAL_SERVICES:
raise wsme.exc.ClientSideError(_(
"Invalid service name"))

View File

@ -834,7 +834,7 @@ def _create(stor, iprofile=None, create_pv=True):
create_attrs)
# Create an osd associated with disk.
if osd_create == True:
if osd_create is True:
try:
new_stor = pecan.request.rpcapi.configure_osd_istor(
pecan.request.context, new_stor)

View File

@ -308,7 +308,7 @@ def _discover_and_validate_glance_hiera_data(caps_dict):
def _check_backend_external(req, storage_external, confirmed=False):
# check if it is running on secondary region
system = pecan.request.dbapi.isystem_get_one()
if system and system.capabilities.get('region_config') != True:
if system and system.capabilities.get('region_config') is not True:
raise wsme.exc.ClientSideError("External backend can only be added on "
"secondary region.")

View File

@ -22,7 +22,7 @@ def _populate_rpm_type(idisk_table):
disks = list(idisk_table.select().where(
idisk_table.c.uuid is not None).execute())
if len(disks) > 0:
idisk_table.update().where(idisk_table.c.rpm == None).values(
idisk_table.update().where(idisk_table.c.rpm is None).values(
{'rpm': constants.DEVICE_TYPE_UNDETERMINED}).execute()

View File

@ -120,7 +120,7 @@ def set_time_override(override_time=datetime.datetime.utcnow()):
def advance_time_delta(timedelta):
"""Advance overridden time using a datetime.timedelta."""
assert(not utcnow.override_time is None)
assert(utcnow.override_time is not None)
try:
for dt in utcnow.override_time:
dt += timedelta

View File

@ -82,7 +82,7 @@ commands =
# H231..H238 are python3 compatability
# H401,H403,H404,H405 are docstring and not important
[flake8]
ignore = E501,E127,E128,E231,E266,E402,E711,E203,E731,E712,E713,E702,E714,E126,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405
ignore = E501,E127,E128,E231,E266,E402,E203,E731,E126,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405
builtins = _
[testenv:flake8]