From d60e4d87d8e83cc7810af2b8a9e01147096b3475 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 8 Nov 2019 10:53:40 -0800 Subject: mpm: Clean up code, improve Pylint score Many small cleanups: - Fix copyright headers - Fix superfluous imports - Pull some constants out of classes where appropriate - Fix formatting - Improve/fix some docstrings - Disable specific Pylint warnings where appropriate - Global catches use BaseException instead of Exception - Don't use len() for empty checks - Make sure to declare all self attributes in __init__ (note: this is particularly of interest for E310, becuase its regular init happens outside of __init__) - Compacted some E310 code that had multi-DB checks --- mpm/python/usrp_mpm/rpc_server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mpm/python/usrp_mpm/rpc_server.py') diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py index 17179f04d..1dc9d7065 100644 --- a/mpm/python/usrp_mpm/rpc_server.py +++ b/mpm/python/usrp_mpm/rpc_server.py @@ -286,7 +286,7 @@ class MPMServer(RPCServer): self._state.claim_status.value = True self.periph_manager.claimed = True self.periph_manager.claim() - if self.periph_manager.clear_rpc_method_registry_on_unclaim: + if self.periph_manager.clear_rpc_registry_on_unclaim: self._init_rpc_calls(self.periph_manager) self._state.lock.release() self.session_id = session_id + " ({})".format(self.client_host) @@ -339,14 +339,14 @@ class MPMServer(RPCServer): self._state.claim_status.value = False self._state.claim_token.value = b'' self.session_id = None - if self.periph_manager.clear_rpc_method_registry_on_unclaim: + if self.periph_manager.clear_rpc_registry_on_unclaim: self.clear_method_registry() try: self.periph_manager.claimed = False self.periph_manager.unclaim() self.periph_manager.set_connection_type(None) self.periph_manager.deinit() - except Exception as ex: + except BaseException as ex: self._last_error = str(ex) self.log.error("deinit() failed: %s", str(ex)) # Don't want to propagate this failure -- the session is over -- cgit v1.2.3