Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 14, 2024
1 parent b340c2d commit e7a0fde
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
16 changes: 12 additions & 4 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,9 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
# Assign tasks to and start shell channel thread.
manager = self.shell_channel_thread.manager
self.shell_channel_thread.add_task(self.shell_channel_thread_main)
self.shell_channel_thread.add_task(manager.listen_from_control, self.shell_main, self.shell_channel_thread)
self.shell_channel_thread.add_task(
manager.listen_from_control, self.shell_main, self.shell_channel_thread
)
self.shell_channel_thread.add_task(manager.listen_from_subshells)
self.shell_channel_thread.start()
else:
Expand Down Expand Up @@ -1082,7 +1084,9 @@ async def create_subshell_request(self, socket, ident, parent) -> None:

# This should only be called in the control thread if it exists.
# Request is passed to shell channel thread to process.
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
self.control_thread.get_task_group()
)
await other_socket.asend_json({"type": "create"})
reply = await other_socket.arecv_json()

Expand All @@ -1104,7 +1108,9 @@ async def delete_subshell_request(self, socket, ident, parent) -> None:

# This should only be called in the control thread if it exists.
# Request is passed to shell channel thread to process.
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
self.control_thread.get_task_group()
)
await other_socket.asend_json({"type": "delete", "subshell_id": subshell_id})
reply = await other_socket.arecv_json()

Expand All @@ -1119,7 +1125,9 @@ async def list_subshell_request(self, socket, ident, parent) -> None:

# This should only be called in the control thread if it exists.
# Request is passed to shell channel thread to process.
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(self.control_thread.get_task_group())
other_socket = await self.shell_channel_thread.manager.get_control_other_socket(
self.control_thread.get_task_group()
)
await other_socket.asend_json({"type": "list"})
reply = await other_socket.arecv_json()

Expand Down
4 changes: 3 additions & 1 deletion ipykernel/subshell_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def _is_subshell(self, subshell_id: str | None) -> bool:
with self._lock_cache:
return subshell_id in self._cache

async def _listen_for_subshell_reply(self, subshell_id: str | None, task_group: TaskGroup) -> None:
async def _listen_for_subshell_reply(
self, subshell_id: str | None, task_group: TaskGroup
) -> None:
"""Listen for reply messages on specified subshell inproc socket and
resend to the client via the shell_socket.
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
resource = None # type:ignore


@pytest.fixture
@pytest.fixture()
def anyio_backend():
return "asyncio"


pytestmark = pytest.mark.anyio


Expand Down
2 changes: 1 addition & 1 deletion tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def subprocess_test_echo_watch():


@pytest.mark.anyio()
#@pytest.mark.skipif(sys.platform.startswith("win"), reason="Windows")
# @pytest.mark.skipif(sys.platform.startswith("win"), reason="Windows")
@pytest.mark.skip(reason="FIXME")
async def test_echo_watch(ctx):
"""Test echo on underlying FD while capturing the same FD
Expand Down

0 comments on commit e7a0fde

Please sign in to comment.