From 0fa543936d3f9ee69f6b9f8bd5a316692fde9aaa Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 10 Sep 2024 15:13:53 +0200 Subject: [PATCH] Remove direct use of asyncio (#1266) --- ipykernel/iostream.py | 2 -- ipykernel/kernelbase.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ipykernel/iostream.py b/ipykernel/iostream.py index ea70831b..6280905c 100644 --- a/ipykernel/iostream.py +++ b/ipykernel/iostream.py @@ -3,7 +3,6 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. -import asyncio import atexit import contextvars import io @@ -99,7 +98,6 @@ def __init__(self, socket, pipe=False): self._event_pipes: Dict[threading.Thread, Any] = {} self._event_pipe_gc_lock: threading.Lock = threading.Lock() self._event_pipe_gc_seconds: float = 10 - self._event_pipe_gc_task: Optional[asyncio.Task[Any]] = None self._setup_event_pipe() tasks = [self._handle_event, self._run_event_pipe_gc] if pipe: diff --git a/ipykernel/kernelbase.py b/ipykernel/kernelbase.py index e5f5c1ee..050f57be 100644 --- a/ipykernel/kernelbase.py +++ b/ipykernel/kernelbase.py @@ -4,7 +4,6 @@ # Distributed under the terms of the Modified BSD License. from __future__ import annotations -import asyncio import inspect import itertools import logging @@ -1258,7 +1257,7 @@ async def _progressively_terminate_all_children(self): delay, children, ) - await asyncio.sleep(delay) + await sleep(delay) async def _at_shutdown(self): """Actions taken at shutdown by the kernel, called by python's atexit."""