| 1 |
"""Abstract base class for kernel managers.""" |
| 2 |
|
| 3 |
# Copyright (c) Jupyter Development Team. |
| 4 |
# Distributed under the terms of the Modified BSD License. |
| 5 |
import abc |
| 6 |
from typing import Any |
| 7 |
|
| 8 |
|
| 9 |
class KernelManagerABC(metaclass=abc.ABCMeta): |
| 10 |
"""KernelManager ABC. |
| 11 |
|
| 12 |
The docstrings for this class can be found in the base implementation: |
| 13 |
|
| 14 |
`jupyter_client.manager.KernelManager` |
| 15 |
""" |
| 16 |
|
| 17 |
@abc.abstractproperty |
| 18 |
def kernel(self) -> Any: |
| 19 |
pass |
| 20 |
|
| 21 |
# -------------------------------------------------------------------------- |
| 22 |
# Kernel management |
| 23 |
# -------------------------------------------------------------------------- |
| 24 |
|
| 25 |
@abc.abstractmethod |
| 26 |
def start_kernel(self, **kw: Any) -> None: |
| 27 |
"""Start the kernel.""" |
| 28 |
pass |
| 29 |
|
| 30 |
@abc.abstractmethod |
| 31 |
def shutdown_kernel(self, now: bool = False, restart: bool = False) -> None: |
| 32 |
"""Shut down the kernel.""" |
| 33 |
pass |
| 34 |
|
| 35 |
@abc.abstractmethod |
| 36 |
def restart_kernel(self, now: bool = False, **kw: Any) -> None: |
| 37 |
"""Restart the kernel.""" |
| 38 |
pass |
| 39 |
|
| 40 |
@abc.abstractproperty |
| 41 |
def has_kernel(self) -> bool: |
| 42 |
pass |
| 43 |
|
| 44 |
@abc.abstractmethod |
| 45 |
def interrupt_kernel(self) -> None: |
| 46 |
"""Interrupt the kernel.""" |
| 47 |
pass |
| 48 |
|
| 49 |
@abc.abstractmethod |
| 50 |
def signal_kernel(self, signum: int) -> None: |
| 51 |
"""Send a signal to the kernel.""" |
| 52 |
pass |
| 53 |
|
| 54 |
@abc.abstractmethod |
| 55 |
def is_alive(self) -> bool: |
| 56 |
"""Test whether the kernel is alive.""" |
| 57 |
pass |