pep8 corrections
@@ -19,11 +19,13 @@ import uuid
from qtconsole.qt import QtCore
from qtconsole.util import MetaQObjectHasTraits, SuperQObject
+
class CommManager(MetaQObjectHasTraits(
'NewBase', (LoggingConfigurable, SuperQObject), {})):
"""
Manager for Comms in the Frontend
"""
+
def __init__(self, kernel_client, *args, **kwargs):
super(CommManager, self).__init__(*args, **kwargs)
self.comms = {}
@@ -58,7 +60,7 @@ class CommManager(MetaQObjectHasTraits(
self.register_comm(comm)
try:
comm.open(data, metadata, buffers)
- except:
+ except Exception:
self.unregister_comm(comm)
raise
return comm
@@ -110,8 +112,8 @@ class CommManager(MetaQObjectHasTraits(
return self.comms[comm_id]
except KeyError:
self.log.warning("No such comm: %s", comm_id)
- if self.log.isEnabledFor(logging.DEBUG):
# don't create the list of keys if debug messages aren't enabled
+ if self.log.isEnabledFor(logging.DEBUG):
self.log.debug("Current comms: %s", list(self.comms.keys()))
# comm message handlers
@@ -138,9 +140,10 @@ class CommManager(MetaQObjectHasTraits(
# Failure.
try:
comm.close()
- except:
- self.log.error("""Could not close comm during `comm_open` failure
- clean-up. The comm may not have been opened yet.""",
+ except Exception:
+ self.log.error(
+ "Could not close comm during `comm_open` failure "
+ "clean-up. The comm may not have been opened yet.""",
exc_info=True)
def comm_close(self, msg):
@@ -172,6 +175,7 @@ class CommManager(MetaQObjectHasTraits(
self.log.error('Exception in comm_msg for %s', comm_id,
exc_info=True)
+
class Comm(MetaQObjectHasTraits(
'NewBase', (LoggingConfigurable, SuperQObject), {})):
"""
@@ -262,4 +266,5 @@ class Comm(MetaQObjectHasTraits(
if self._close_callback:
return self._close_callback(msg)
+
__all__ = ['CommManager']
