1111# Imports
1212# -----------------------------------------------------------------------------
1313
14+ from typing import Any
15+
1416from jupyter_client .client import KernelClient
1517from jupyter_client .clientabc import KernelClientABC
1618
@@ -54,9 +56,9 @@ def _default_blocking_class(self):
5456
5557 return BlockingInProcessKernelClient
5658
57- def get_connection_info (self ):
59+ def get_connection_info (self , session : bool = False ):
5860 """Get the connection info for the client."""
59- d = super ().get_connection_info ()
61+ d = super ().get_connection_info (session = session )
6062 d ["kernel" ] = self .kernel # type:ignore[assignment]
6163 return d
6264
@@ -99,9 +101,18 @@ def hb_channel(self):
99101 # Methods for sending specific messages
100102 # -------------------------------------
101103
102- async def execute (
103- self , code , silent = False , store_history = True , user_expressions = None , allow_stdin = None
104- ):
104+ # Feb 2025: superclass in jupyter-Client is sync,
105+ # it should likely be made all consistent and push
106+ # jupyter_client async as well
107+ async def execute ( # type:ignore [override]
108+ self ,
109+ code : str ,
110+ silent : bool = False ,
111+ store_history : bool = True ,
112+ user_expressions : dict [str , Any ] | None = None ,
113+ allow_stdin : bool | None = None ,
114+ stop_on_error : bool = True ,
115+ ) -> str :
105116 """Execute code on the client."""
106117 if allow_stdin is None :
107118 allow_stdin = self .allow_stdin
@@ -114,7 +125,9 @@ async def execute(
114125 )
115126 msg = self .session .msg ("execute_request" , content )
116127 await self ._dispatch_to_kernel (msg )
117- return msg ["header" ]["msg_id" ]
128+ res = msg ["header" ]["msg_id" ]
129+ assert isinstance (res , str )
130+ return res
118131
119132 async def complete (self , code , cursor_pos = None ):
120133 """Get code completion."""
0 commit comments