Skip to content

Commit 04be394

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ee38f9e commit 04be394

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

ipykernel/kernelbase.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
551551
# Assign tasks to and start shell channel thread.
552552
manager = self.shell_channel_thread.manager
553553
self.shell_channel_thread.add_task(self.shell_channel_thread_main)
554-
self.shell_channel_thread.add_task(manager.listen_from_control, self.shell_main, self.shell_channel_thread)
554+
self.shell_channel_thread.add_task(
555+
manager.listen_from_control, self.shell_main, self.shell_channel_thread
556+
)
555557
self.shell_channel_thread.add_task(manager.listen_from_subshells)
556558
self.shell_channel_thread.start()
557559
else:
@@ -1081,7 +1083,9 @@ async def create_subshell_request(self, socket, ident, parent) -> None:
10811083

10821084
# This should only be called in the control thread if it exists.
10831085
# Request is passed to shell channel thread to process.
1084-
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
1086+
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
1087+
self.control_thread.get_task_group()
1088+
)
10851089
await other_socket.asend_json({"type": "create"})
10861090
reply = await other_socket.arecv_json()
10871091

@@ -1103,7 +1107,9 @@ async def delete_subshell_request(self, socket, ident, parent) -> None:
11031107

11041108
# This should only be called in the control thread if it exists.
11051109
# Request is passed to shell channel thread to process.
1106-
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
1110+
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
1111+
self.control_thread.get_task_group()
1112+
)
11071113
await other_socket.asend_json({"type": "delete", "subshell_id": subshell_id})
11081114
reply = await other_socket.arecv_json()
11091115

@@ -1118,7 +1124,9 @@ async def list_subshell_request(self, socket, ident, parent) -> None:
11181124

11191125
# This should only be called in the control thread if it exists.
11201126
# Request is passed to shell channel thread to process.
1121-
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
1127+
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
1128+
self.control_thread.get_task_group()
1129+
)
11221130
await other_socket.asend_json({"type": "list"})
11231131
reply = await other_socket.arecv_json()
11241132

ipykernel/subshell_manager.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ class SubshellManager:
4040
against multiple subshells attempting to send at the same time.
4141
"""
4242

43-
def __init__(self, context: zmq.Context, shell_socket: zmq_anyio.Socket, get_task_group: Callable[[], TaskGroup]):
43+
def __init__(
44+
self,
45+
context: zmq.Context,
46+
shell_socket: zmq_anyio.Socket,
47+
get_task_group: Callable[[], TaskGroup],
48+
):
4449
assert current_thread() == main_thread()
4550

4651
self._context: zmq.Context = context
@@ -229,7 +234,9 @@ def _is_subshell(self, subshell_id: str | None) -> bool:
229234
with self._lock_cache:
230235
return subshell_id in self._cache
231236

232-
async def _listen_for_subshell_reply(self, subshell_id: str | None, task_group: TaskGroup) -> None:
237+
async def _listen_for_subshell_reply(
238+
self, subshell_id: str | None, task_group: TaskGroup
239+
) -> None:
233240
"""Listen for reply messages on specified subshell inproc socket and
234241
resend to the client via the shell_socket.
235242

tests/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
resource = None # type:ignore
2323

2424

25-
@pytest.fixture
25+
@pytest.fixture()
2626
def anyio_backend():
2727
return "asyncio"
2828

29+
2930
pytestmark = pytest.mark.anyio
3031

3132

0 commit comments

Comments
 (0)