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