22
33# Copyright (c) IPython Development Team.
44# Distributed under the terms of the Modified BSD License.
5+ from __future__ import annotations
56
67import asyncio
78import concurrent .futures
@@ -80,7 +81,7 @@ class Kernel(SingletonConfigurable):
8081 # attribute to override with a GUI
8182 eventloop = Any (None )
8283
83- processes : t . Dict [str , psutil .Process ] = {}
84+ processes : dict [str , psutil .Process ] = {}
8485
8586 @observe ("eventloop" )
8687 def _update_eventloop (self , change ):
@@ -93,7 +94,7 @@ def _update_eventloop(self, change):
9394 profile_dir = Instance ("IPython.core.profiledir.ProfileDir" , allow_none = True )
9495 shell_stream = Instance (ZMQStream , allow_none = True )
9596
96- shell_streams = List (
97+ shell_streams : List [ t . Any ] = List (
9798 help = """Deprecated shell_streams alias. Use shell_stream
9899
99100 .. versionchanged:: 6.0
@@ -153,10 +154,10 @@ def _default_ident(self):
153154
154155 # This should be overridden by wrapper kernels that implement any real
155156 # language.
156- language_info : t . Dict [str , object ] = {}
157+ language_info : dict [str , object ] = {}
157158
158159 # any links that should go in the help menu
159- help_links = List ()
160+ help_links : List [ dict [ str , str ]] = List ()
160161
161162 # Experimental option to break in non-user code.
162163 # The ipykernel source is in the call stack, so the user
@@ -180,7 +181,7 @@ def _default_ident(self):
180181
181182 # track associations with current request
182183 _allow_stdin = Bool (False )
183- _parents = Dict ({"shell" : {}, "control" : {}})
184+ _parents : Dict [ str , t . Any ] = Dict ({"shell" : {}, "control" : {}})
184185 _parent_ident = Dict ({"shell" : b"" , "control" : b"" })
185186
186187 @property
@@ -291,7 +292,7 @@ async def poll_control_queue(self):
291292
292293 async def _flush_control_queue (self ):
293294 """Flush the control queue, wait for processing of any pending messages"""
294- tracer_future : t . Union [ concurrent .futures .Future [object ], asyncio .Future [object ] ]
295+ tracer_future : concurrent .futures .Future [object ] | asyncio .Future [object ]
295296 if self .control_thread :
296297 control_loop = self .control_thread .io_loop
297298 # concurrent.futures.Futures are threadsafe
@@ -945,7 +946,7 @@ async def interrupt_request(self, stream, ident, parent):
945946 """Handle an interrupt request."""
946947 if not self .session :
947948 return
948- content : t . Dict [str , t .Any ] = {"status" : "ok" }
949+ content : dict [str , t .Any ] = {"status" : "ok" }
949950 try :
950951 self ._send_interrupt_children ()
951952 except OSError as err :
0 commit comments