Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #494 #495

Merged
merged 1 commit into from Aug 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 6 additions & 21 deletions qtconsole/manager.py
Expand Up @@ -6,7 +6,6 @@
# Local imports
from traitlets import Bool, DottedObjectName

import jupyter_client
from jupyter_client import KernelManager
from jupyter_client.restarter import KernelRestarter

Expand All @@ -28,25 +27,6 @@ def poll(self):
super().poll()


def _post_start_kernel():
# KernelManager.post_start_kernel is async in jupyter_client>=7.0
if int(jupyter_client.__version__.split(".")[0]) >= 7:
async def post_start_kernel(self, **kw):
"""Kernel restarted."""
await super(QtKernelManager, self).post_start_kernel(**kw)
if self._is_restarting:
self.kernel_restarted.emit()
self._is_restarting = False
else:
def post_start_kernel(self, **kw):
"""Kernel restarted."""
super(QtKernelManager, self).post_start_kernel(**kw)
if self._is_restarting:
self.kernel_restarted.emit()
self._is_restarting = False
return post_start_kernel


class QtKernelManager(KernelManager, QtKernelManagerMixin):
"""A KernelManager with Qt signals for restart"""

Expand Down Expand Up @@ -75,7 +55,12 @@ def stop_restarter(self):
if self._restarter is not None:
self._restarter.stop()

post_start_kernel = _post_start_kernel()
def post_start_kernel(self, **kw):
"""Kernel restarted."""
super().post_start_kernel(**kw)
if self._is_restarting:
self.kernel_restarted.emit()
self._is_restarting = False

def _handle_kernel_restarting(self):
"""Kernel has died, and will be restarted."""
Expand Down