Unsupress pylint warnings.

The W291,W292,W391,W503,W601 warnings were fixed and
tox.ini updated accordingly.

Story: 2002803
Task: 26911

Change-Id: I1e5f0b1f72b06ad8b5cac07921e9d14171623ba0
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2018-10-04 12:39:59 -05:00
parent 6c5b844111
commit 54f4802bb1
18 changed files with 15 additions and 33 deletions

View File

@ -346,10 +346,10 @@ class ServiceNodeController(rest.RestController):
# all the services are in the standby state on the
# other host
# or service only provisioned in the other host
# or service state are the same on both hosts
# or service state are the same on both hosts
if SM_SERVICE_GROUP_STATE_ACTIVE != sm_sda.state \
and SM_SERVICE_GROUP_STATE_STANDBY != sm_sda.state \
and origin_state.has_key(sm_sda.service_group_name) \
and sm_sda.service_group_name in origin_state \
and origin_state[sm_sda.service_group_name] != sm_sda.state:
check_result = (
"%s on %s is not ready to take service, "

View File

@ -73,18 +73,19 @@ class ParsableErrorMiddleware(object):
app_iter = self.app(environ, replacement_start_response)
if (state['status_code'] / 100) not in (2, 3):
req = webob.Request(environ)
if (req.accept.best_match(['application/json', 'application/xml'])
== 'application/xml'):
if (req.accept.best_match(
['application/json', 'application/xml']) ==
'application/xml'):
try:
# simple check xml is valid
body = [et.ElementTree.tostring(
et.ElementTree.fromstring('<error_message>'
+ '\n'.join(app_iter)
+ '</error_message>'))]
et.ElementTree.fromstring('<error_message>' +
'\n'.join(app_iter) +
'</error_message>'))]
except et.ElementTree.ParseError as err:
LOG.error('Error parsing HTTP response: %s' % err)
body = ['<error_message>%s' % state['status_code']
+ '</error_message>']
body = ['<error_message>%s' % state['status_code'] +
'</error_message>']
state['headers'].append(('Content-Type', 'application/xml'))
else:
body = [json.dumps({'error_message': '\n'.join(app_iter)})]

View File

@ -402,4 +402,4 @@ class HTTPNotFound(NotFound):
class ServiceNotFound(NotFound):
message = _("service %(service)s could not be found.")
message = _("service %(service)s could not be found.")

View File

@ -17,4 +17,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -17,4 +17,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -86,7 +86,7 @@ class FixedIntervalLoopingCall(LoopingCallBase):
delay = interval - timeutils.delta_seconds(start, end)
if delay <= 0:
LOG.warn(_('task run outlasted interval by %s sec') %
-delay)
(delay * -1))
greenthread.sleep(delay if delay > 0 else 0)
except LoopingCallDone as e:
self.stop()

View File

@ -15,4 +15,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -17,4 +17,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -104,8 +104,8 @@ def _check_for_lock():
if not CONF.debug:
return None
if ((hasattr(local.strong_store, 'locks_held')
and local.strong_store.locks_held)):
if ((hasattr(local.strong_store, 'locks_held') and
local.strong_store.locks_held)):
stack = ' :: '.join([frame[3] for frame in inspect.stack()])
LOG.warn(_('A RPC is being made while holding a lock. The locks '
'currently held are %(locks)s. This is probably a bug. '

View File

@ -15,4 +15,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -15,4 +15,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -17,4 +17,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -18,4 +18,3 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#

View File

@ -61,5 +61,3 @@ def do_service_show(cc, args):
if getattr(service, 'node_name', None) is None:
setattr(service, 'hostname', socket.gethostname())
_print_service_show(service)

View File

@ -50,7 +50,7 @@ def main():
database.close()
SM_VAR_RUN_SERVICES_DIR = '/var/run/sm/services'
unmanage_filepath = SM_VAR_RUN_SERVICES_DIR + '/'
unmanage_filepath = SM_VAR_RUN_SERVICES_DIR + '/'
unmanage_filename = "%s.unmanaged" % args.service
if 'manage' == action:

View File

@ -65,4 +65,3 @@ def restart_service_safe(service_name):
service_name, SM_API_MSG_SKIP_DEP_CHECK))
_send_msg_to_sm(sm_api_msg)

View File

@ -199,4 +199,3 @@ def main():
sys.stderr.close()
except:
pass

View File

@ -94,12 +94,6 @@ commands =
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
# H501: Do not use locals() for string formatting
# - other warnings
# W291 trailing whitespace
# W292 no newline at end of file
# W391 blank line at end of file
# W503 line break before binary operator
# W601 .has_key() is deprecated, use 'in'
# - errors -
# F401 <foo> imported but unused
# F811 redefinition of unused '<foo>' from line <x>
@ -117,7 +111,6 @@ commands =
ignore= E114,E116,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E228,E231,E241,E251,E265,E271,
E302,E303,E305,E402,E713,E714,E722,E731,E999,
H102,H104,H105,H106,H201,H231,H233,H236,H306,H401,H403,H404,H405,H501,
W291,W292,W391,W503,W601,
F401,F811,F821,F841,
B001,B004,B006,B007,B008,B303,B305,B306
# Enable checks which are off by default