Skip to content

Commit 4ab7ad1

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7cd30c7 commit 4ab7ad1

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

ipykernel/kernelbase.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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`
@@ -682,7 +682,7 @@ def _publish_execute_input(self, code, parent, execution_count):
682682
"""Publish the code request on the iopub stream."""
683683
if not self.session:
684684
return
685-
#with self._iant_lock:
685+
# with self._iant_lock:
686686
with open("debug.txt", "a") as f:
687687
f.write(f"{threading.current_thread().ident} iopub_socket execute_input\n")
688688

@@ -698,7 +698,7 @@ def _publish_status(self, status, channel, parent=None):
698698
"""send status (busy/idle) on IOPub"""
699699
if not self.session:
700700
return
701-
#with self._iant_lock:
701+
# with self._iant_lock:
702702
with open("debug.txt", "a") as f:
703703
f.write(f"{threading.current_thread().ident} iopub_socket status {status}\n")
704704

@@ -719,7 +719,7 @@ def _publish_status_and_flush(self, status, channel, stream, parent=None):
719719
def _publish_debug_event(self, event):
720720
if not self.session:
721721
return
722-
#with self._iant_lock:
722+
# with self._iant_lock:
723723
with open("debug.txt", "a") as f:
724724
f.write(f"{threading.current_thread().ident} iopub_socket debug_event\n")
725725

@@ -1234,11 +1234,9 @@ async def create_subshell_request(self, socket, ident, parent) -> None:
12341234
self.log.error("Subshells are not supported by this kernel")
12351235
return
12361236

1237-
12381237
with open("debug.txt", "a") as f:
12391238
f.write(f"{threading.current_thread().ident} ? create_subshell_request\n")
12401239

1241-
12421240
assert threading.current_thread().name == CONTROL_THREAD_NAME
12431241

12441242
# This should only be called in the control thread if it exists.
@@ -1646,7 +1644,7 @@ async def _at_shutdown(self):
16461644

16471645
finally:
16481646
if self._shutdown_message is not None and self.session:
1649-
#with self._iant_lock:
1647+
# with self._iant_lock:
16501648
with open("debug.txt", "a") as f:
16511649
f.write(f"{threading.current_thread().ident} ? _shutdown\n")
16521650

tests/test_subshells.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create_subshell_helper(kc: BlockingKernelClient):
2020
kc.control_channel.send(msg)
2121
msg_id = msg["header"]["msg_id"]
2222
reply = get_reply(kc, msg_id, TIMEOUT, channel="control")
23-
#wait_for_idle(kc, msg_id)
23+
# wait_for_idle(kc, msg_id)
2424
return reply["content"]
2525

2626

@@ -29,7 +29,7 @@ def delete_subshell_helper(kc: BlockingKernelClient, subshell_id: str):
2929
kc.control_channel.send(msg)
3030
msg_id = msg["header"]["msg_id"]
3131
reply = get_reply(kc, msg_id, TIMEOUT, channel="control")
32-
#wait_for_idle(kc, msg_id)
32+
# wait_for_idle(kc, msg_id)
3333
return reply["content"]
3434

3535

@@ -38,7 +38,7 @@ def list_subshell_helper(kc: BlockingKernelClient):
3838
kc.control_channel.send(msg)
3939
msg_id = msg["header"]["msg_id"]
4040
reply = get_reply(kc, msg_id, TIMEOUT, channel="control")
41-
#wait_for_idle(kc, msg_id)
41+
# wait_for_idle(kc, msg_id)
4242
return reply["content"]
4343

4444

@@ -52,7 +52,6 @@ def execute_request(kc: BlockingKernelClient, code: str, subshell_id: str | None
5252
def execute_request_subshell_id(
5353
kc: BlockingKernelClient, code: str, subshell_id: str | None, terminator: str = "\n"
5454
):
55-
5655
with open("debug.txt", "a") as f:
5756
f.write("CHECK 1\n")
5857

@@ -126,7 +125,7 @@ def test_thread_ids():
126125
thread_id, main_thread_id = execute_thread_ids(kc)
127126
assert thread_id == main_thread_id
128127

129-
thread_id, main_thread_id = execute_thread_ids(kc, subshell_id) # This is the problem
128+
thread_id, main_thread_id = execute_thread_ids(kc, subshell_id) # This is the problem
130129
assert thread_id != main_thread_id
131130

132131
delete_subshell_helper(kc, subshell_id)

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def assemble_output(get_msg, timeout=1, parent_msg_id: str | None = None):
178178
stderr = ""
179179
while True:
180180
msg = get_msg(timeout=timeout)
181-
#with open("debug.txt", "a") as f:
181+
# with open("debug.txt", "a") as f:
182182
# f.write(f"assembly output {msg}\n")
183183
msg_type = msg["msg_type"]
184184
content = msg["content"]

0 commit comments

Comments
 (0)