1212# -----------------------------------------------------------------------------
1313
1414import asyncio
15+ from typing import Any
1516
1617from jupyter_client .client import KernelClient
1718from jupyter_client .clientabc import KernelClientABC
@@ -57,9 +58,9 @@ def _default_blocking_class(self):
5758
5859 return BlockingInProcessKernelClient
5960
60- def get_connection_info (self ):
61+ def get_connection_info (self , session : bool = False ):
6162 """Get the connection info for the client."""
62- d = super ().get_connection_info ()
63+ d = super ().get_connection_info (session = session )
6364 d ["kernel" ] = self .kernel # type:ignore[assignment]
6465 return d
6566
@@ -103,8 +104,14 @@ def hb_channel(self):
103104 # -------------------------------------
104105
105106 def execute (
106- self , code , silent = False , store_history = True , user_expressions = None , allow_stdin = None
107- ):
107+ self ,
108+ code : str ,
109+ silent : bool = False ,
110+ store_history : bool = True ,
111+ user_expressions : dict [str , Any ] | None = None ,
112+ allow_stdin : bool | None = None ,
113+ stop_on_error : bool = True ,
114+ ) -> str :
108115 """Execute code on the client."""
109116 if allow_stdin is None :
110117 allow_stdin = self .allow_stdin
@@ -117,7 +124,9 @@ def execute(
117124 )
118125 msg = self .session .msg ("execute_request" , content )
119126 self ._dispatch_to_kernel (msg )
120- return msg ["header" ]["msg_id" ]
127+ res = msg ["header" ]["msg_id" ]
128+ assert isinstance (res , str )
129+ return res
121130
122131 def complete (self , code , cursor_pos = None ):
123132 """Get code completion."""
0 commit comments