File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 66from ipython_genutils .importstring import import_item
77from tornado import web , gen
88
9- from nbclassic .utils import maybe_future , url2path
9+ from jupyter_server .utils import url2path
1010from nbclassic .base .handlers import IPythonHandler
1111from nbclassic .services .config import ConfigManager
1212
1313from . import tools
1414
1515
16+ def maybe_future (obj ):
17+ """Like tornado's deprecated gen.maybe_future
18+
19+ but more compatible with asyncio for recent versions
20+ of tornado
21+ """
22+ if inspect .isawaitable (obj ):
23+ return asyncio .ensure_future (obj )
24+ elif isinstance (obj , concurrent .futures .Future ):
25+ return asyncio .wrap_future (obj )
26+ else :
27+ # not awaitable, wrap scalar in future
28+ f = asyncio .Future ()
29+ f .set_result (obj )
30+ return f
31+
32+
1633class BundlerHandler (IPythonHandler ):
1734 def initialize (self ):
1835 """Make tools module available on the handler instance for compatibility
Original file line number Diff line number Diff line change 11import os
22
3- from nbclassic .utils import url_path_join
3+ from jupyter_server .utils import url_path_join
44from nbclassic .tests .selenium .utils import wait_for_selector
55pjoin = os .path .join
66
You can’t perform that action at this time.
0 commit comments