Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/jupyter_client/clientabc.py: 69%
48 statements
« prev ^ index » next coverage.py v7.3.3, created at 2023-12-15 06:13 +0000
« prev ^ index » next coverage.py v7.3.3, created at 2023-12-15 06:13 +0000
1"""Abstract base class for kernel clients"""
2# -----------------------------------------------------------------------------
3# Copyright (c) The Jupyter Development Team
4#
5# Distributed under the terms of the BSD License. The full license is in
6# the file COPYING, distributed as part of this software.
7# -----------------------------------------------------------------------------
8# -----------------------------------------------------------------------------
9# Imports
10# -----------------------------------------------------------------------------
11from __future__ import annotations
13import abc
14from typing import TYPE_CHECKING, Any
16if TYPE_CHECKING:
17 from .channelsabc import ChannelABC
19# -----------------------------------------------------------------------------
20# Main kernel client class
21# -----------------------------------------------------------------------------
24class KernelClientABC(metaclass=abc.ABCMeta):
25 """KernelManager ABC.
27 The docstrings for this class can be found in the base implementation:
29 `jupyter_client.client.KernelClient`
30 """
32 @abc.abstractproperty
33 def kernel(self) -> Any:
34 pass
36 @abc.abstractproperty
37 def shell_channel_class(self) -> type[ChannelABC]:
38 pass
40 @abc.abstractproperty
41 def iopub_channel_class(self) -> type[ChannelABC]:
42 pass
44 @abc.abstractproperty
45 def hb_channel_class(self) -> type[ChannelABC]:
46 pass
48 @abc.abstractproperty
49 def stdin_channel_class(self) -> type[ChannelABC]:
50 pass
52 @abc.abstractproperty
53 def control_channel_class(self) -> type[ChannelABC]:
54 pass
56 # --------------------------------------------------------------------------
57 # Channel management methods
58 # --------------------------------------------------------------------------
60 @abc.abstractmethod
61 def start_channels(
62 self,
63 shell: bool = True,
64 iopub: bool = True,
65 stdin: bool = True,
66 hb: bool = True,
67 control: bool = True,
68 ) -> None:
69 """Start the channels for the client."""
70 pass
72 @abc.abstractmethod
73 def stop_channels(self) -> None:
74 """Stop the channels for the client."""
75 pass
77 @abc.abstractproperty
78 def channels_running(self) -> bool:
79 """Get whether the channels are running."""
80 pass
82 @abc.abstractproperty
83 def shell_channel(self) -> ChannelABC:
84 pass
86 @abc.abstractproperty
87 def iopub_channel(self) -> ChannelABC:
88 pass
90 @abc.abstractproperty
91 def stdin_channel(self) -> ChannelABC:
92 pass
94 @abc.abstractproperty
95 def hb_channel(self) -> ChannelABC:
96 pass
98 @abc.abstractproperty
99 def control_channel(self) -> ChannelABC:
100 pass