@@ -277,7 +277,7 @@ def __init__(self, **kwargs):
277277 """Initialize the kernel."""
278278 super ().__init__ (** kwargs )
279279
280- #self._iant_lock = threading.Lock()
280+ # self._iant_lock = threading.Lock()
281281
282282 # Kernel application may swap stdout and stderr to OutStream,
283283 # which is the case in `IPKernelApp.init_io`, hence `sys.stdout`
@@ -425,7 +425,7 @@ async def dispatch_shell(self, msg, /, stream=None, subshell_id: str | None = No
425425 except Exception :
426426 self .log .debug ("Unable to signal in pre_handler_hook:" , exc_info = True )
427427 try :
428- #result = handler(stream, idents, msg)
428+ # result = handler(stream, idents, msg)
429429 result = handler (self .shell_stream , idents , msg )
430430 if inspect .isawaitable (result ):
431431 await result
@@ -575,7 +575,7 @@ def schedule_dispatch(self, dispatch, *args):
575575 def start (self ):
576576 """register dispatchers for streams"""
577577
578- #with open("debug.txt", "a") as f:
578+ # with open("debug.txt", "a") as f:
579579 # f.write(f"--- kernelbase start --- {threading.main_thread().ident}\n")
580580
581581 self .io_loop = ioloop .IOLoop .current ()
@@ -616,7 +616,7 @@ async def shell_channel_thread_main(self, msg):
616616 msg3 = self .session .deserialize (msg2 , content = False , copy = False )
617617 subshell_id = msg3 ["header" ].get ("subshell_id" )
618618
619- #with open("debug.txt", "a") as f:
619+ # with open("debug.txt", "a") as f:
620620 # f.write(
621621 # f"{threading.current_thread().ident} shell_channel_thread_main msg received for {subshell_id}\n"
622622 # )
@@ -635,7 +635,7 @@ async def shell_channel_thread_main(self, msg):
635635 async def shell_main (self , subshell_id : str | None , msg ):
636636 """Handler of shell messages for a single subshell"""
637637
638- #with open("debug.txt", "a") as f:
638+ # with open("debug.txt", "a") as f:
639639 # f.write(f"{threading.current_thread().ident} shell_main msg recvd on {subshell_id}\n")
640640
641641 if self ._supports_kernel_subshells :
@@ -683,8 +683,8 @@ def _publish_execute_input(self, code, parent, execution_count):
683683 """Publish the code request on the iopub stream."""
684684 if not self .session :
685685 return
686- #with self._iant_lock:
687- #with open("debug.txt", "a") as f:
686+ # with self._iant_lock:
687+ # with open("debug.txt", "a") as f:
688688 # f.write(f"{threading.current_thread().ident} iopub_socket execute_input\n")
689689
690690 self .session .send (
@@ -699,8 +699,8 @@ def _publish_status(self, status, channel, parent=None):
699699 """send status (busy/idle) on IOPub"""
700700 if not self .session :
701701 return
702- #with self._iant_lock:
703- #with open("debug.txt", "a") as f:
702+ # with self._iant_lock:
703+ # with open("debug.txt", "a") as f:
704704 # f.write(f"{threading.current_thread().ident} iopub_socket status {status}\n")
705705 # f.write(f"SESSION {self.session}\n")
706706
@@ -721,8 +721,8 @@ def _publish_status_and_flush(self, status, channel, stream, parent=None):
721721 def _publish_debug_event (self , event ):
722722 if not self .session :
723723 return
724- #with self._iant_lock:
725- #with open("debug.txt", "a") as f:
724+ # with self._iant_lock:
725+ # with open("debug.txt", "a") as f:
726726 # f.write(f"{threading.current_thread().ident} iopub_socket debug_event\n")
727727
728728 self .session .send (
@@ -793,7 +793,7 @@ def send_response(
793793 if not self .session :
794794 return None
795795
796- #with open("debug.txt", "a") as f:
796+ # with open("debug.txt", "a") as f:
797797 # f.write(f"{threading.current_thread().ident} ? ?send_response\n")
798798
799799 return self .session .send (
@@ -871,7 +871,7 @@ async def execute_request(self, stream, ident, parent):
871871 subshell_id = parent ["header" ].get ("subshell_id" )
872872 msg_id = parent ["header" ].get ("msg_id" )
873873
874- #with open("debug.txt", "a") as f:
874+ # with open("debug.txt", "a") as f:
875875 # f.write(
876876 # f"{threading.current_thread().ident} about to execute_request {msg_id} {subshell_id} {code}\n"
877877 # )
@@ -895,7 +895,7 @@ async def execute_request(self, stream, ident, parent):
895895 reply_content = json_clean (reply_content )
896896 metadata = self .finish_metadata (parent , metadata , reply_content )
897897
898- #with open("debug.txt", "a") as f:
898+ # with open("debug.txt", "a") as f:
899899 # f.write(
900900 # f"{threading.current_thread().ident} execute_reply {msg_id} {subshell_id} {reply_content}\n"
901901 # )
@@ -990,7 +990,7 @@ async def history_request(self, stream, ident, parent):
990990
991991 reply_content = json_clean (reply_content )
992992
993- #with open("debug.txt", "a") as f:
993+ # with open("debug.txt", "a") as f:
994994 # f.write(f"{threading.current_thread().ident} ? history_reply\n")
995995
996996 msg = self .session .send (stream , "history_reply" , reply_content , parent , ident )
@@ -1018,7 +1018,7 @@ async def connect_request(self, stream, ident, parent):
10181018 content = self ._recorded_ports .copy () if self ._recorded_ports else {}
10191019 content ["status" ] = "ok"
10201020
1021- #with open("debug.txt", "a") as f:
1021+ # with open("debug.txt", "a") as f:
10221022 # f.write(f"{threading.current_thread().ident} ? connect_reply\n")
10231023
10241024 msg = self .session .send (stream , "connect_reply" , content , parent , ident )
@@ -1046,7 +1046,7 @@ async def kernel_info_request(self, stream, ident, parent):
10461046 content = {"status" : "ok" }
10471047 content .update (self .kernel_info )
10481048
1049- #with open("debug.txt", "a") as f:
1049+ # with open("debug.txt", "a") as f:
10501050 # f.write(f"{threading.current_thread().ident} ? kernel_info_reply\n")
10511051
10521052 msg = self .session .send (stream , "kernel_info_reply" , content , parent , ident )
@@ -1117,7 +1117,7 @@ async def shutdown_request(self, stream, ident, parent):
11171117 if inspect .isawaitable (content ):
11181118 content = await content
11191119
1120- #with open("debug.txt", "a") as f:
1120+ # with open("debug.txt", "a") as f:
11211121 # f.write(f"{threading.current_thread().ident} ? shutdown_reply\n")
11221122
11231123 self .session .send (stream , "shutdown_reply" , content , parent , ident = ident )
@@ -1171,7 +1171,7 @@ async def debug_request(self, stream, ident, parent):
11711171 reply_content = await reply_content
11721172 reply_content = json_clean (reply_content )
11731173
1174- #with open("debug.txt", "a") as f:
1174+ # with open("debug.txt", "a") as f:
11751175 # f.write(f"{threading.current_thread().ident} ? debug_reply\n")
11761176
11771177 reply_msg = self .session .send (stream , "debug_reply" , reply_content , parent , ident )
@@ -1236,7 +1236,7 @@ async def create_subshell_request(self, socket, ident, parent) -> None:
12361236 self .log .error ("Subshells are not supported by this kernel" )
12371237 return
12381238
1239- #with open("debug.txt", "a") as f:
1239+ # with open("debug.txt", "a") as f:
12401240 # f.write(f"{threading.current_thread().ident} ? create_subshell_request\n")
12411241
12421242 assert threading .current_thread ().name == CONTROL_THREAD_NAME
@@ -1247,7 +1247,7 @@ async def create_subshell_request(self, socket, ident, parent) -> None:
12471247 other_socket .send_json ({"type" : "create" })
12481248 reply = other_socket .recv_json ()
12491249
1250- #with open("debug.txt", "a") as f:
1250+ # with open("debug.txt", "a") as f:
12511251 # f.write(f"{threading.current_thread().ident} ? create_subshell_reply\n")
12521252
12531253 self .session .send (socket , "create_subshell_reply" , reply , parent , ident )
@@ -1274,7 +1274,7 @@ async def delete_subshell_request(self, socket, ident, parent) -> None:
12741274 other_socket .send_json ({"type" : "delete" , "subshell_id" : subshell_id })
12751275 reply = other_socket .recv_json ()
12761276
1277- #with open("debug.txt", "a") as f:
1277+ # with open("debug.txt", "a") as f:
12781278 # f.write(f"{threading.current_thread().ident} ? delete_subshell_reply\n")
12791279
12801280 self .session .send (socket , "delete_subshell_reply" , reply , parent , ident )
@@ -1294,7 +1294,7 @@ async def list_subshell_request(self, socket, ident, parent) -> None:
12941294 other_socket .send_json ({"type" : "list" })
12951295 reply = other_socket .recv_json ()
12961296
1297- #with open("debug.txt", "a") as f:
1297+ # with open("debug.txt", "a") as f:
12981298 # f.write(f"{threading.current_thread().ident} ? list_subshell_reply\n")
12991299
13001300 self .session .send (socket , "list_subshell_reply" , reply , parent , ident )
@@ -1362,7 +1362,7 @@ async def abort_request(self, stream, ident, parent): # pragma: no cover
13621362 if not self .session :
13631363 return
13641364
1365- #with open("debug.txt", "a") as f:
1365+ # with open("debug.txt", "a") as f:
13661366 # f.write(f"{threading.current_thread().ident} ? abort_reply\n")
13671367
13681368 reply_msg = self .session .send (
@@ -1463,7 +1463,7 @@ def _send_abort_reply(self, stream, msg, idents):
14631463 md = self .finish_metadata (msg , md , status )
14641464 md .update (status )
14651465
1466- #with open("debug.txt", "a") as f:
1466+ # with open("debug.txt", "a") as f:
14671467 # f.write(f"{threading.current_thread().ident} ? {reply_type}\n")
14681468
14691469 self .session .send (
@@ -1646,8 +1646,8 @@ async def _at_shutdown(self):
16461646
16471647 finally :
16481648 if self ._shutdown_message is not None and self .session :
1649- #with self._iant_lock:
1650- #with open("debug.txt", "a") as f:
1649+ # with self._iant_lock:
1650+ # with open("debug.txt", "a") as f:
16511651 # f.write(f"{threading.current_thread().ident} ? _shutdown\n")
16521652
16531653 self .session .send (
0 commit comments