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