Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ying-Qiu Zheng
fsleyes
Commits
53904068
Commit
53904068
authored
Feb 24, 2021
by
Paul McCarthy
🚵
Browse files
RF: Update notebook kernel manager to use async/await rather than
tornado coroutine
parent
dc78031d
Changes
1
Hide whitespace changes
Inline
Side-by-side
assets/jupyter/fsleyes_kernelmanager.py
View file @
53904068
...
...
@@ -6,8 +6,6 @@
#
from
tornado
import
gen
from
notebook.services.kernels.kernelmanager
import
MappingKernelManager
...
...
@@ -25,7 +23,7 @@ class FSLeyesNotebookKernelManager(MappingKernelManager):
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
FSLeyesNotebookKernelManager
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
def
__patch_connection
(
self
,
kernel
):
...
...
@@ -40,16 +38,14 @@ class FSLeyesNotebookKernelManager(MappingKernelManager):
kernel
.
load_connection_file
(
self
.
connfile
)
@
gen
.
coroutine
def
start_kernel
(
self
,
**
kwargs
):
async
def
start_kernel
(
self
,
**
kwargs
):
"""Overrides ``MappingKernelManager.start_kernel``. Connects
all new kernels to the IPython kernel specified by ``connfile``.
"""
kid
=
super
(
FSLeyesNotebookKernelManager
,
self
)
\
.
start_kernel
(
**
kwargs
).
result
()
kid
=
await
super
().
start_kernel
(
**
kwargs
)
kernel
=
self
.
_kernels
[
kid
]
self
.
__patch_connection
(
kernel
)
r
aise
gen
.
R
eturn
(
kid
)
return
kid
def
restart_kernel
(
self
,
*
args
,
**
kwargs
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment