File tree 2 files changed +2
-19
lines changed
2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change 3
3
# Distributed under the terms of the Modified BSD License.
4
4
import errno
5
5
import importlib .util
6
- import inspect
7
6
import os
8
7
import socket
9
8
import sys
14
13
from urllib .request import pathname2url # noqa: F401
15
14
16
15
from _frozen_importlib_external import _NamespacePath
16
+ from jupyter_core .utils import ensure_async # noqa: F401
17
17
from packaging .version import Version
18
18
from tornado .httpclient import AsyncHTTPClient , HTTPClient , HTTPRequest
19
19
from tornado .netutil import Resolver
@@ -173,23 +173,6 @@ def _check_pid_posix(pid):
173
173
check_pid = _check_pid_posix
174
174
175
175
176
- async def ensure_async (obj ):
177
- """Convert a non-awaitable object to a coroutine if needed,
178
- and await it if it was not already awaited.
179
- """
180
- if inspect .isawaitable (obj ):
181
- try :
182
- result = await obj
183
- except RuntimeError as e :
184
- if str (e ) == "cannot reuse already awaited coroutine" :
185
- # obj is already the coroutine's result
186
- return obj
187
- raise
188
- return result
189
- # obj doesn't need to be awaited
190
- return obj
191
-
192
-
193
176
async def run_sync_in_loop (maybe_async ):
194
177
"""**DEPRECATED**: Use ``ensure_async`` instead."""
195
178
warnings .warn (
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ dependencies = [
31
31
" argon2-cffi" ,
32
32
" jinja2" ,
33
33
" jupyter_client>=7.4.4" ,
34
- " jupyter_core>=4.9.2 " ,
34
+ " jupyter_core>=4.12,!=~5.0 " ,
35
35
" jupyter_server_terminals" ,
36
36
" nbconvert>=6.4.4" ,
37
37
" nbformat>=5.3.0" ,
You can’t perform that action at this time.
0 commit comments