From 54f4802bb14ebbb79811fce8722af6efe68a7ab0 Mon Sep 17 00:00:00 2001 From: Erich Cordoba Date: Thu, 4 Oct 2018 12:39:59 -0500 Subject: [PATCH] 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 --- .../sm_api/api/controllers/v1/servicenode.py | 4 ++-- .../sm_api/api/middleware/parsable_error.py | 15 ++++++++------- .../sm-api/sm_api/common/exception.py | 2 +- .../sm-api/sm_api/openstack/common/db/__init__.py | 1 - .../openstack/common/db/sqlalchemy/__init__.py | 1 - .../sm-api/sm_api/openstack/common/loopingcall.py | 2 +- .../sm_api/openstack/common/notifier/__init__.py | 1 - .../sm_api/openstack/common/rootwrap/__init__.py | 1 - .../sm_api/openstack/common/rpc/__init__.py | 4 ++-- .../sm-client/sm_client/openstack/__init__.py | 1 - .../sm_client/openstack/common/__init__.py | 1 - .../openstack/common/rootwrap/__init__.py | 1 - .../sm-client/sm_client/v1/__init__.py | 1 - .../sm-client/sm_client/v1/smc_service_shell.py | 2 -- service-mgmt-tools/sm-tools/sm_tools/sm_action.py | 2 +- .../sm-tools/sm_tools/sm_api_msg_utils.py | 1 - service-mgmt-tools/sm-tools/sm_tools/sm_dump.py | 1 - tox.ini | 7 ------- 18 files changed, 15 insertions(+), 33 deletions(-) diff --git a/service-mgmt-api/sm-api/sm_api/api/controllers/v1/servicenode.py b/service-mgmt-api/sm-api/sm_api/api/controllers/v1/servicenode.py index 0c28350c..fd1d0479 100755 --- a/service-mgmt-api/sm-api/sm_api/api/controllers/v1/servicenode.py +++ b/service-mgmt-api/sm-api/sm_api/api/controllers/v1/servicenode.py @@ -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, " diff --git a/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py b/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py index 1ee34519..212ab796 100644 --- a/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py +++ b/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py @@ -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('' - + '\n'.join(app_iter) - + ''))] + et.ElementTree.fromstring('' + + '\n'.join(app_iter) + + ''))] except et.ElementTree.ParseError as err: LOG.error('Error parsing HTTP response: %s' % err) - body = ['%s' % state['status_code'] - + ''] + body = ['%s' % state['status_code'] + + ''] state['headers'].append(('Content-Type', 'application/xml')) else: body = [json.dumps({'error_message': '\n'.join(app_iter)})] diff --git a/service-mgmt-api/sm-api/sm_api/common/exception.py b/service-mgmt-api/sm-api/sm_api/common/exception.py index 200bad45..78d4543b 100644 --- a/service-mgmt-api/sm-api/sm_api/common/exception.py +++ b/service-mgmt-api/sm-api/sm_api/common/exception.py @@ -402,4 +402,4 @@ class HTTPNotFound(NotFound): class ServiceNotFound(NotFound): - message = _("service %(service)s could not be found.") \ No newline at end of file + message = _("service %(service)s could not be found.") diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/db/__init__.py b/service-mgmt-api/sm-api/sm_api/openstack/common/db/__init__.py index 0d617c5c..8297c19d 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/db/__init__.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/db/__init__.py @@ -17,4 +17,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/__init__.py b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/__init__.py index 0d617c5c..8297c19d 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/__init__.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/__init__.py @@ -17,4 +17,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/loopingcall.py b/service-mgmt-api/sm-api/sm_api/openstack/common/loopingcall.py index 51e0e74b..182d097b 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/loopingcall.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/loopingcall.py @@ -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() diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/notifier/__init__.py b/service-mgmt-api/sm-api/sm_api/openstack/common/notifier/__init__.py index 95c9e656..9347e5fb 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/notifier/__init__.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/notifier/__init__.py @@ -15,4 +15,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/__init__.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/__init__.py index c0b12fbe..6528899b 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/__init__.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/__init__.py @@ -17,4 +17,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/__init__.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/__init__.py index 0ffc0716..42e447a1 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/__init__.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/__init__.py @@ -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. ' diff --git a/service-mgmt-client/sm-client/sm_client/openstack/__init__.py b/service-mgmt-client/sm-client/sm_client/openstack/__init__.py index 4bab4c35..e59efde7 100644 --- a/service-mgmt-client/sm-client/sm_client/openstack/__init__.py +++ b/service-mgmt-client/sm-client/sm_client/openstack/__init__.py @@ -15,4 +15,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-client/sm-client/sm_client/openstack/common/__init__.py b/service-mgmt-client/sm-client/sm_client/openstack/common/__init__.py index 4bab4c35..e59efde7 100644 --- a/service-mgmt-client/sm-client/sm_client/openstack/common/__init__.py +++ b/service-mgmt-client/sm-client/sm_client/openstack/common/__init__.py @@ -15,4 +15,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-client/sm-client/sm_client/openstack/common/rootwrap/__init__.py b/service-mgmt-client/sm-client/sm_client/openstack/common/rootwrap/__init__.py index c0b12fbe..6528899b 100644 --- a/service-mgmt-client/sm-client/sm_client/openstack/common/rootwrap/__init__.py +++ b/service-mgmt-client/sm-client/sm_client/openstack/common/rootwrap/__init__.py @@ -17,4 +17,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-client/sm-client/sm_client/v1/__init__.py b/service-mgmt-client/sm-client/sm_client/v1/__init__.py index 69b48868..17d0614c 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/__init__.py +++ b/service-mgmt-client/sm-client/sm_client/v1/__init__.py @@ -18,4 +18,3 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # - diff --git a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py index 1edbe0cc..cd5872e1 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py +++ b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py @@ -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) - - diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_action.py b/service-mgmt-tools/sm-tools/sm_tools/sm_action.py index 8115be65..7956f0ea 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_action.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_action.py @@ -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: diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py b/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py index ef3dc79d..031718e3 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py @@ -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) - diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py b/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py index 288b5288..9d8ca67d 100755 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py @@ -199,4 +199,3 @@ def main(): sys.stderr.close() except: pass - diff --git a/tox.ini b/tox.ini index 40dc8106..abf41758 100644 --- a/tox.ini +++ b/tox.ini @@ -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 imported but unused # F811 redefinition of unused '' from line @@ -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