| 1 |
"""Abstract base classes for kernel client channels""" |
| 2 |
|
| 3 |
# Copyright (c) Jupyter Development Team. |
| 4 |
# Distributed under the terms of the Modified BSD License. |
| 5 |
import abc |
| 6 |
|
| 7 |
|
| 8 |
class ChannelABC(metaclass=abc.ABCMeta): |
| 9 |
"""A base class for all channel ABCs.""" |
| 10 |
|
| 11 |
@abc.abstractmethod |
| 12 |
def start(self) -> None: |
| 13 |
"""Start the channel.""" |
| 14 |
pass |
| 15 |
|
| 16 |
@abc.abstractmethod |
| 17 |
def stop(self) -> None: |
| 18 |
"""Stop the channel.""" |
| 19 |
pass |
| 20 |
|
| 21 |
@abc.abstractmethod |
| 22 |
def is_alive(self) -> bool: |
| 23 |
"""Test whether the channel is alive.""" |
| 24 |
pass |
| 25 |
|
| 26 |
|
| 27 |
class HBChannelABC(ChannelABC): |
| 28 |
"""HBChannel ABC. |
| 29 |
|
| 30 |
The docstrings for this class can be found in the base implementation: |
| 31 |
|
| 32 |
`jupyter_client.channels.HBChannel` |
| 33 |
""" |
| 34 |
|
| 35 |
@abc.abstractproperty |
| 36 |
def time_to_dead(self) -> float: |
| 37 |
pass |
| 38 |
|
| 39 |
@abc.abstractmethod |
| 40 |
def pause(self) -> None: |
| 41 |
"""Pause the heartbeat channel.""" |
| 42 |
pass |
| 43 |
|
| 44 |
@abc.abstractmethod |
| 45 |
def unpause(self) -> None: |
| 46 |
"""Unpause the heartbeat channel.""" |
| 47 |
pass |
| 48 |
|
| 49 |
@abc.abstractmethod |
| 50 |
def is_beating(self) -> bool: |
| 51 |
"""Test whether the channel is beating.""" |
| 52 |
pass |