@@ -235,7 +235,7 @@ def remove_restart_callback(self, callback: t.Callable, event: str = "restart")
235
235
# create a Client connected to our Kernel
236
236
# --------------------------------------------------------------------------
237
237
238
- def client (self , ** kwargs : Any ) -> KernelClient :
238
+ def client (self , ** kwargs : t . Any ) -> KernelClient :
239
239
"""Create a client configured to connect to our kernel"""
240
240
kw = {}
241
241
kw .update (self .get_connection_info (session = True ))
@@ -296,7 +296,7 @@ def from_ns(match):
296
296
297
297
return [pat .sub (from_ns , arg ) for arg in cmd ]
298
298
299
- async def _async_launch_kernel (self , kernel_cmd : t .List [str ], ** kw : Any ) -> None :
299
+ async def _async_launch_kernel (self , kernel_cmd : t .List [str ], ** kw : t . Any ) -> None :
300
300
"""actually launch the kernel
301
301
302
302
override in a subclass to launch kernel subprocesses differently
@@ -324,7 +324,9 @@ def _close_control_socket(self) -> None:
324
324
self ._control_socket .close ()
325
325
self ._control_socket = None
326
326
327
- async def _async_pre_start_kernel (self , ** kw : Any ) -> t .Tuple [t .List [str ], t .Dict [str , t .Any ]]:
327
+ async def _async_pre_start_kernel (
328
+ self , ** kw : t .Any
329
+ ) -> t .Tuple [t .List [str ], t .Dict [str , t .Any ]]:
328
330
"""Prepares a kernel for startup in a separate process.
329
331
330
332
If random ports (port=0) are being used, this method must be called
@@ -352,7 +354,7 @@ async def _async_pre_start_kernel(self, **kw: Any) -> t.Tuple[t.List[str], t.Dic
352
354
353
355
pre_start_kernel = run_sync (_async_pre_start_kernel )
354
356
355
- async def _async_post_start_kernel (self , ** kw : Any ) -> None :
357
+ async def _async_post_start_kernel (self , ** kw : t . Any ) -> None :
356
358
"""Performs any post startup tasks relative to the kernel.
357
359
358
360
Parameters
@@ -368,7 +370,7 @@ async def _async_post_start_kernel(self, **kw: Any) -> None:
368
370
post_start_kernel = run_sync (_async_post_start_kernel )
369
371
370
372
@in_pending_state
371
- async def _async_start_kernel (self , ** kw : Any ) -> None :
373
+ async def _async_start_kernel (self , ** kw : t . Any ) -> None :
372
374
"""Starts a kernel on this host in a separate process.
373
375
374
376
If random ports (port=0) are being used, this method must be called
@@ -500,7 +502,7 @@ async def _async_shutdown_kernel(self, now: bool = False, restart: bool = False)
500
502
shutdown_kernel = run_sync (_async_shutdown_kernel )
501
503
502
504
async def _async_restart_kernel (
503
- self , now : bool = False , newports : bool = False , ** kw : Any
505
+ self , now : bool = False , newports : bool = False , ** kw : t . Any
504
506
) -> None :
505
507
"""Restarts a kernel with the arguments that were used to launch it.
506
508
@@ -661,7 +663,7 @@ class AsyncKernelManager(KernelManager):
661
663
662
664
663
665
def start_new_kernel (
664
- startup_timeout : float = 60 , kernel_name : str = "python" , ** kwargs : Any
666
+ startup_timeout : float = 60 , kernel_name : str = "python" , ** kwargs : t . Any
665
667
) -> t .Tuple [KernelManager , KernelClient ]:
666
668
"""Start a new kernel, and return its Manager and Client"""
667
669
km = KernelManager (kernel_name = kernel_name )
@@ -679,7 +681,7 @@ def start_new_kernel(
679
681
680
682
681
683
async def start_new_async_kernel (
682
- startup_timeout : float = 60 , kernel_name : str = "python" , ** kwargs : Any
684
+ startup_timeout : float = 60 , kernel_name : str = "python" , ** kwargs : t . Any
683
685
) -> t .Tuple [AsyncKernelManager , KernelClient ]:
684
686
"""Start a new kernel, and return its Manager and Client"""
685
687
km = AsyncKernelManager (kernel_name = kernel_name )
@@ -697,7 +699,7 @@ async def start_new_async_kernel(
697
699
698
700
699
701
@contextmanager
700
- def run_kernel (** kwargs : Any ) -> t .Iterator [KernelClient ]:
702
+ def run_kernel (** kwargs : t . Any ) -> t .Iterator [KernelClient ]:
701
703
"""Context manager to create a kernel in a subprocess.
702
704
703
705
The kernel is shut down when the context exits.
0 commit comments