Use newer flake8 on python3.8 zuul systems
flake8 2.5.5 fails on ubuntu-focal zuul machines running python3.8 with the following error: AttributeError: 'FlakesChecker' object has no attribute 'CONSTANT' Fixed: E117 over-indented E741 ambiguous variable name F841 local variable is assigned to but never used Per-Line-Suppressed: E402 module level import not at top of file F632 use ==/!= to compare constant literals Global Suppress: W504 line break after binary operator W605 invalid escape sequence The suppressed errors can be fixed by later submissions. Change-Id: I2df3ece427f0c84ce16c1a82f4d9f0c9a5a6982b Partial-Bug: 1895054 Signed-off-by: albailey <Al.Bailey@windriver.com>
This commit is contained in:
parent
454aa61326
commit
42a9cfa882
@ -140,17 +140,17 @@ class FaultAPIsBase(object):
|
|||||||
""" Validate the attributes
|
""" Validate the attributes
|
||||||
only applies to Telco specific attributes"""
|
only applies to Telco specific attributes"""
|
||||||
if data.alarm_state not in constants.ALARM_STATE:
|
if data.alarm_state not in constants.ALARM_STATE:
|
||||||
raise ClientException("Invalid Fault State: %s" %
|
raise ClientException("Invalid Fault State: %s" %
|
||||||
data.alarm_state)
|
data.alarm_state)
|
||||||
if data.severity not in constants.ALARM_SEVERITY:
|
if data.severity not in constants.ALARM_SEVERITY:
|
||||||
raise ClientException("Invalid Fault Severity: %s" %
|
raise ClientException("Invalid Fault Severity: %s" %
|
||||||
data.severity)
|
data.severity)
|
||||||
if data.alarm_type not in constants.ALARM_TYPE:
|
if data.alarm_type not in constants.ALARM_TYPE:
|
||||||
raise ClientException("Invalid Fault Type: %s" %
|
raise ClientException("Invalid Fault Type: %s" %
|
||||||
data.alarm_type)
|
data.alarm_type)
|
||||||
if data.probable_cause not in constants.ALARM_PROBABLE_CAUSE:
|
if data.probable_cause not in constants.ALARM_PROBABLE_CAUSE:
|
||||||
raise ClientException("Invalid Fault Probable Cause: %s" %
|
raise ClientException("Invalid Fault Probable Cause: %s" %
|
||||||
data.probable_cause)
|
data.probable_cause)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def alarm_allowed(alarm_severity, threshold):
|
def alarm_allowed(alarm_severity, threshold):
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import sys
|
import sys
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
cfg.CONF(sys.argv[1:], project='fm')
|
cfg.CONF(sys.argv[1:], project='fm')
|
||||||
from fm.db import migration
|
from fm.db import migration # noqa: E402
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class HTTPClient(_BaseHTTPClient):
|
|||||||
if kwargs.get('insecure', False) is True:
|
if kwargs.get('insecure', False) is True:
|
||||||
self.session.verify = False
|
self.session.verify = False
|
||||||
else:
|
else:
|
||||||
if kwargs.get('cacert', None) is not '':
|
if kwargs.get('cacert', None) is not '': # noqa: F632
|
||||||
self.session.verify = kwargs.get('cacert', True)
|
self.session.verify = kwargs.get('cacert', True)
|
||||||
|
|
||||||
self.session.cert = (kwargs.get('cert_file'),
|
self.session.cert = (kwargs.get('cert_file'),
|
||||||
|
@ -315,7 +315,7 @@ def main():
|
|||||||
print('caught: %r, aborting' % (e), file=sys.stderr)
|
print('caught: %r, aborting' % (e), file=sys.stderr)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
except IOError as e:
|
except IOError:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -11,7 +11,7 @@ from fmclient.common import base
|
|||||||
|
|
||||||
class EventLog(base.Resource):
|
class EventLog(base.Resource):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<EventLog %s>" % self._info
|
return "<EventLog %s>" % self._info
|
||||||
|
|
||||||
|
|
||||||
class EventLogManager(base.Manager):
|
class EventLogManager(base.Manager):
|
||||||
|
@ -79,8 +79,8 @@ def do_event_list(cc, args={}):
|
|||||||
logs = cc.event_log.list(q=queryAsArray, limit=args.limit,
|
logs = cc.event_log.list(q=queryAsArray, limit=args.limit,
|
||||||
alarms=alarms, logs=logs,
|
alarms=alarms, logs=logs,
|
||||||
include_suppress=include_suppress)
|
include_suppress=include_suppress)
|
||||||
for l in logs:
|
for lg in logs:
|
||||||
utils.normalize_field_data(l, ['entity_instance_id', 'reason_text'])
|
utils.normalize_field_data(lg, ['entity_instance_id', 'reason_text'])
|
||||||
|
|
||||||
# omit action initially to keep output width sane
|
# omit action initially to keep output width sane
|
||||||
# (can switch over to vertical formatting when available from CLIFF)
|
# (can switch over to vertical formatting when available from CLIFF)
|
||||||
|
@ -12,7 +12,7 @@ from fmclient.common import base
|
|||||||
|
|
||||||
class EventSuppression(base.Resource):
|
class EventSuppression(base.Resource):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<EventSuppression %s>" % self._info
|
return "<EventSuppression %s>" % self._info
|
||||||
|
|
||||||
|
|
||||||
class EventSuppressionManager(base.Manager):
|
class EventSuppressionManager(base.Manager):
|
||||||
|
@ -82,24 +82,24 @@ def print_event_suppression_list(cc, no_paging, includeUUID):
|
|||||||
|
|
||||||
|
|
||||||
def event_suppression_update(cc, data, suppress=False):
|
def event_suppression_update(cc, data, suppress=False):
|
||||||
event_suppression_list = _event_suppression_list(cc, include_unsuppressed=True)
|
event_suppression_list = _event_suppression_list(cc, include_unsuppressed=True)
|
||||||
|
|
||||||
alarm_id_list = []
|
alarm_id_list = []
|
||||||
for alarm_id in data['alarm_id'].split(',') or []:
|
for alarm_id in data['alarm_id'].split(',') or []:
|
||||||
alarm_id_list.append(alarm_id)
|
alarm_id_list.append(alarm_id)
|
||||||
|
|
||||||
if suppress:
|
if suppress:
|
||||||
patch_value = 'suppressed'
|
patch_value = 'suppressed'
|
||||||
else:
|
else:
|
||||||
patch_value = 'unsuppressed'
|
patch_value = 'unsuppressed'
|
||||||
|
|
||||||
patch = []
|
patch = []
|
||||||
for event_id in event_suppression_list:
|
for event_id in event_suppression_list:
|
||||||
if event_id.alarm_id in alarm_id_list:
|
if event_id.alarm_id in alarm_id_list:
|
||||||
print("Alarm ID: {} {}.".format(event_id.alarm_id, patch_value))
|
print("Alarm ID: {} {}.".format(event_id.alarm_id, patch_value))
|
||||||
uuid = event_id.uuid
|
uuid = event_id.uuid
|
||||||
patch.append(dict(path='/' + 'suppression_status', value=patch_value, op='replace'))
|
patch.append(dict(path='/' + 'suppression_status', value=patch_value, op='replace'))
|
||||||
cc.event_suppression.update(uuid, patch)
|
cc.event_suppression.update(uuid, patch)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('--include-unsuppressed', action='store_true',
|
@utils.arg('--include-unsuppressed', action='store_true',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
hacking!=0.13.0,<0.14,>=0.12.0
|
hacking
|
||||||
bashate >= 0.2
|
bashate >= 0.2
|
||||||
mock
|
mock
|
||||||
PyYAML >= 3.1.0
|
PyYAML >= 3.1.0
|
||||||
|
5
tox.ini
5
tox.ini
@ -88,11 +88,14 @@ commands =
|
|||||||
# H405 multi line docstring summary not separated with an empty line
|
# H405 multi line docstring summary not separated with an empty line
|
||||||
# H702 Argument to ... must be a string
|
# H702 Argument to ... must be a string
|
||||||
# H903 Windows style line endings not allowed in code
|
# H903 Windows style line endings not allowed in code
|
||||||
|
# W504 line break after binary operator
|
||||||
|
# W605 invalid escape sequence
|
||||||
# E123, E125 skipped as they are invalid PEP-8.
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
# E501 skipped because some of the code files include templates
|
# E501 skipped because some of the code files include templates
|
||||||
# that end up quite wide
|
# that end up quite wide
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,E123,E125,E501
|
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,
|
||||||
|
W504,W605,E123,E125,E501
|
||||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||||
# TODO: H106 Don’t put vim configuration in source files (off by default).
|
# TODO: H106 Don’t put vim configuration in source files (off by default).
|
||||||
# H203 Use assertIs(Not)None to check for None (off by default).
|
# H203 Use assertIs(Not)None to check for None (off by default).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user