Skip to content

Commit

Permalink
Merge pull request #495 from davidbrochart/revert_pr494
Browse files Browse the repository at this point in the history
Revert #494
  • Loading branch information
ccordoba12 committed Aug 4, 2021
2 parents 80481f8 + 85c9e6f commit 6ce0c48
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions qtconsole/manager.py
Original file line number Diff line number Diff line change
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

0 comments on commit 6ce0c48

Please sign in to comment.