@@ -119,7 +119,7 @@ def __init__(self, **kwargs):
119119 # Build dict of handlers for message types
120120 msg_types = [ 'execute_request' , 'complete_request' ,
121121 'inspect_request' , 'history_request' ,
122- 'kernel_info_request' ,
122+ 'comm_info_request' , ' kernel_info_request' ,
123123 'connect_request' , 'shutdown_request' ,
124124 'apply_request' , 'is_complete_request' ,
125125 ]
@@ -435,7 +435,7 @@ def inspect_request(self, stream, ident, parent):
435435 def do_inspect (self , code , cursor_pos , detail_level = 0 ):
436436 """Override in subclasses to allow introspection.
437437 """
438- return {'status' : 'ok' , 'data' :{}, 'metadata' :{}, 'found' :False }
438+ return {'status' : 'ok' , 'data' : {}, 'metadata' : {}, 'found' : False }
439439
440440 def history_request (self , stream , ident , parent ):
441441 content = parent ['content' ]
@@ -478,6 +478,24 @@ def kernel_info_request(self, stream, ident, parent):
478478 self .kernel_info , parent , ident )
479479 self .log .debug ("%s" , msg )
480480
481+ def comm_info_request (self , stream , ident , parent ):
482+ content = parent ['content' ]
483+ target_name = content .get ('target_name' , None )
484+
485+ # Should this be moved to ipkernel?
486+ if hasattr (self , 'comm_manager' ):
487+ comms = {
488+ k : dict (target_name = v .target_name )
489+ for (k , v ) in self .comm_manager .comms .items ()
490+ if v .target_name == target_name or target_name is None
491+ }
492+ else :
493+ comms = {}
494+ reply_content = dict (comms = comms )
495+ msg = self .session .send (stream , 'comm_info_reply' ,
496+ reply_content , parent , ident )
497+ self .log .debug ("%s" , msg )
498+
481499 def shutdown_request (self , stream , ident , parent ):
482500 content = self .do_shutdown (parent ['content' ]['restart' ])
483501 self .session .send (stream , u'shutdown_reply' , content , parent , ident = ident )
0 commit comments