##// END OF EJS Templates
remove leftover duplication from splitting clientabc/channelabc
MinRK -
Show More
@@ -1,193 +1,127 b''
1 """Abstract base classes for kernel client channels"""
1 """Abstract base classes for kernel client channels"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (C) 2013 The IPython Development Team
4 # Copyright (C) 2013 The IPython Development Team
5 #
5 #
6 # Distributed under the terms of the BSD License. The full license is in
6 # Distributed under the terms of the BSD License. The full license is in
7 # the file COPYING, distributed as part of this software.
7 # the file COPYING, distributed as part of this software.
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9
9
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11 # Imports
11 # Imports
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13
13
14 # Standard library imports
14 # Standard library imports
15 import abc
15 import abc
16
16
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 # Channels
18 # Channels
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20
20
21
21
22 class ChannelABC(object):
22 class ChannelABC(object):
23 """A base class for all channel ABCs."""
23 """A base class for all channel ABCs."""
24
24
25 __metaclass__ = abc.ABCMeta
25 __metaclass__ = abc.ABCMeta
26
26
27 @abc.abstractmethod
27 @abc.abstractmethod
28 def start(self):
28 def start(self):
29 pass
29 pass
30
30
31 @abc.abstractmethod
31 @abc.abstractmethod
32 def stop(self):
32 def stop(self):
33 pass
33 pass
34
34
35 @abc.abstractmethod
35 @abc.abstractmethod
36 def is_alive(self):
36 def is_alive(self):
37 pass
37 pass
38
38
39
39
40 class ShellChannelABC(ChannelABC):
40 class ShellChannelABC(ChannelABC):
41 """ShellChannel ABC.
41 """ShellChannel ABC.
42
42
43 The docstrings for this class can be found in the base implementation:
43 The docstrings for this class can be found in the base implementation:
44
44
45 `IPython.kernel.channels.ShellChannel`
45 `IPython.kernel.channels.ShellChannel`
46 """
46 """
47
47
48 @abc.abstractproperty
48 @abc.abstractproperty
49 def allow_stdin(self):
49 def allow_stdin(self):
50 pass
50 pass
51
51
52 @abc.abstractmethod
52 @abc.abstractmethod
53 def execute(self, code, silent=False, store_history=True,
53 def execute(self, code, silent=False, store_history=True,
54 user_variables=None, user_expressions=None, allow_stdin=None):
54 user_variables=None, user_expressions=None, allow_stdin=None):
55 pass
55 pass
56
56
57 @abc.abstractmethod
57 @abc.abstractmethod
58 def complete(self, text, line, cursor_pos, block=None):
58 def complete(self, text, line, cursor_pos, block=None):
59 pass
59 pass
60
60
61 @abc.abstractmethod
61 @abc.abstractmethod
62 def object_info(self, oname, detail_level=0):
62 def object_info(self, oname, detail_level=0):
63 pass
63 pass
64
64
65 @abc.abstractmethod
65 @abc.abstractmethod
66 def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
66 def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
67 pass
67 pass
68
68
69 @abc.abstractmethod
69 @abc.abstractmethod
70 def kernel_info(self):
70 def kernel_info(self):
71 pass
71 pass
72
72
73 @abc.abstractmethod
73 @abc.abstractmethod
74 def shutdown(self, restart=False):
74 def shutdown(self, restart=False):
75 pass
75 pass
76
76
77
77
78 class IOPubChannelABC(ChannelABC):
78 class IOPubChannelABC(ChannelABC):
79 """IOPubChannel ABC.
79 """IOPubChannel ABC.
80
80
81 The docstrings for this class can be found in the base implementation:
81 The docstrings for this class can be found in the base implementation:
82
82
83 `IPython.kernel.channels.IOPubChannel`
83 `IPython.kernel.channels.IOPubChannel`
84 """
84 """
85
85
86 @abc.abstractmethod
86 @abc.abstractmethod
87 def flush(self, timeout=1.0):
87 def flush(self, timeout=1.0):
88 pass
88 pass
89
89
90
90
91 class StdInChannelABC(ChannelABC):
91 class StdInChannelABC(ChannelABC):
92 """StdInChannel ABC.
92 """StdInChannel ABC.
93
93
94 The docstrings for this class can be found in the base implementation:
94 The docstrings for this class can be found in the base implementation:
95
95
96 `IPython.kernel.channels.StdInChannel`
96 `IPython.kernel.channels.StdInChannel`
97 """
97 """
98
98
99 @abc.abstractmethod
99 @abc.abstractmethod
100 def input(self, string):
100 def input(self, string):
101 pass
101 pass
102
102
103
103
104 class HBChannelABC(ChannelABC):
104 class HBChannelABC(ChannelABC):
105 """HBChannel ABC.
105 """HBChannel ABC.
106
106
107 The docstrings for this class can be found in the base implementation:
107 The docstrings for this class can be found in the base implementation:
108
108
109 `IPython.kernel.channels.HBChannel`
109 `IPython.kernel.channels.HBChannel`
110 """
110 """
111
111
112 @abc.abstractproperty
112 @abc.abstractproperty
113 def time_to_dead(self):
113 def time_to_dead(self):
114 pass
114 pass
115
115
116 @abc.abstractmethod
116 @abc.abstractmethod
117 def pause(self):
117 def pause(self):
118 pass
118 pass
119
119
120 @abc.abstractmethod
120 @abc.abstractmethod
121 def unpause(self):
121 def unpause(self):
122 pass
122 pass
123
123
124 @abc.abstractmethod
124 @abc.abstractmethod
125 def is_beating(self):
125 def is_beating(self):
126 pass
126 pass
127
127
128
129 #-----------------------------------------------------------------------------
130 # Main kernel manager class
131 #-----------------------------------------------------------------------------
132
133 class KernelClientABC(object):
134 """KernelManager ABC.
135
136 The docstrings for this class can be found in the base implementation:
137
138 `IPython.kernel.channels.KernelClient`
139 """
140
141 __metaclass__ = abc.ABCMeta
142
143 @abc.abstractproperty
144 def kernel(self):
145 pass
146
147 @abc.abstractproperty
148 def shell_channel_class(self):
149 pass
150
151 @abc.abstractproperty
152 def iopub_channel_class(self):
153 pass
154
155 @abc.abstractproperty
156 def hb_channel_class(self):
157 pass
158
159 @abc.abstractproperty
160 def stdin_channel_class(self):
161 pass
162
163 #--------------------------------------------------------------------------
164 # Channel management methods
165 #--------------------------------------------------------------------------
166
167 @abc.abstractmethod
168 def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
169 pass
170
171 @abc.abstractmethod
172 def stop_channels(self):
173 pass
174
175 @abc.abstractproperty
176 def channels_running(self):
177 pass
178
179 @abc.abstractproperty
180 def shell_channel(self):
181 pass
182
183 @abc.abstractproperty
184 def iopub_channel(self):
185 pass
186
187 @abc.abstractproperty
188 def stdin_channel(self):
189 pass
190
191 @abc.abstractproperty
192 def hb_channel(self):
193 pass
@@ -1,193 +1,81 b''
1 """Abstract base classes for kernel clients and channels"""
1 """Abstract base class for kernel clients"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (C) 2013 The IPython Development Team
4 # Copyright (C) 2013 The IPython Development Team
5 #
5 #
6 # Distributed under the terms of the BSD License. The full license is in
6 # Distributed under the terms of the BSD License. The full license is in
7 # the file COPYING, distributed as part of this software.
7 # the file COPYING, distributed as part of this software.
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9
9
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11 # Imports
11 # Imports
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13
13
14 # Standard library imports
14 # Standard library imports
15 import abc
15 import abc
16
16
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 # Channels
18 # Main kernel client class
19 #-----------------------------------------------------------------------------
20
21
22 class ChannelABC(object):
23 """A base class for all channel ABCs."""
24
25 __metaclass__ = abc.ABCMeta
26
27 @abc.abstractmethod
28 def start(self):
29 pass
30
31 @abc.abstractmethod
32 def stop(self):
33 pass
34
35 @abc.abstractmethod
36 def is_alive(self):
37 pass
38
39
40 class ShellChannelABC(ChannelABC):
41 """ShellChannel ABC.
42
43 The docstrings for this class can be found in the base implementation:
44
45 `IPython.kernel.kernelmanager.ShellChannel`
46 """
47
48 @abc.abstractproperty
49 def allow_stdin(self):
50 pass
51
52 @abc.abstractmethod
53 def execute(self, code, silent=False, store_history=True,
54 user_variables=None, user_expressions=None, allow_stdin=None):
55 pass
56
57 @abc.abstractmethod
58 def complete(self, text, line, cursor_pos, block=None):
59 pass
60
61 @abc.abstractmethod
62 def object_info(self, oname, detail_level=0):
63 pass
64
65 @abc.abstractmethod
66 def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
67 pass
68
69 @abc.abstractmethod
70 def kernel_info(self):
71 pass
72
73 @abc.abstractmethod
74 def shutdown(self, restart=False):
75 pass
76
77
78 class IOPubChannelABC(ChannelABC):
79 """IOPubChannel ABC.
80
81 The docstrings for this class can be found in the base implementation:
82
83 `IPython.kernel.kernelmanager.IOPubChannel`
84 """
85
86 @abc.abstractmethod
87 def flush(self, timeout=1.0):
88 pass
89
90
91 class StdInChannelABC(ChannelABC):
92 """StdInChannel ABC.
93
94 The docstrings for this class can be found in the base implementation:
95
96 `IPython.kernel.kernelmanager.StdInChannel`
97 """
98
99 @abc.abstractmethod
100 def input(self, string):
101 pass
102
103
104 class HBChannelABC(ChannelABC):
105 """HBChannel ABC.
106
107 The docstrings for this class can be found in the base implementation:
108
109 `IPython.kernel.kernelmanager.HBChannel`
110 """
111
112 @abc.abstractproperty
113 def time_to_dead(self):
114 pass
115
116 @abc.abstractmethod
117 def pause(self):
118 pass
119
120 @abc.abstractmethod
121 def unpause(self):
122 pass
123
124 @abc.abstractmethod
125 def is_beating(self):
126 pass
127
128
129 #-----------------------------------------------------------------------------
130 # Main kernel manager class
131 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
132
20
133 class KernelClientABC(object):
21 class KernelClientABC(object):
134 """KernelManager ABC.
22 """KernelManager ABC.
135
23
136 The docstrings for this class can be found in the base implementation:
24 The docstrings for this class can be found in the base implementation:
137
25
138 `IPython.kernel.kernelmanager.KernelClient`
26 `IPython.kernel.client.KernelClient`
139 """
27 """
140
28
141 __metaclass__ = abc.ABCMeta
29 __metaclass__ = abc.ABCMeta
142
30
143 @abc.abstractproperty
31 @abc.abstractproperty
144 def kernel(self):
32 def kernel(self):
145 pass
33 pass
146
34
147 @abc.abstractproperty
35 @abc.abstractproperty
148 def shell_channel_class(self):
36 def shell_channel_class(self):
149 pass
37 pass
150
38
151 @abc.abstractproperty
39 @abc.abstractproperty
152 def iopub_channel_class(self):
40 def iopub_channel_class(self):
153 pass
41 pass
154
42
155 @abc.abstractproperty
43 @abc.abstractproperty
156 def hb_channel_class(self):
44 def hb_channel_class(self):
157 pass
45 pass
158
46
159 @abc.abstractproperty
47 @abc.abstractproperty
160 def stdin_channel_class(self):
48 def stdin_channel_class(self):
161 pass
49 pass
162
50
163 #--------------------------------------------------------------------------
51 #--------------------------------------------------------------------------
164 # Channel management methods
52 # Channel management methods
165 #--------------------------------------------------------------------------
53 #--------------------------------------------------------------------------
166
54
167 @abc.abstractmethod
55 @abc.abstractmethod
168 def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
56 def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
169 pass
57 pass
170
58
171 @abc.abstractmethod
59 @abc.abstractmethod
172 def stop_channels(self):
60 def stop_channels(self):
173 pass
61 pass
174
62
175 @abc.abstractproperty
63 @abc.abstractproperty
176 def channels_running(self):
64 def channels_running(self):
177 pass
65 pass
178
66
179 @abc.abstractproperty
67 @abc.abstractproperty
180 def shell_channel(self):
68 def shell_channel(self):
181 pass
69 pass
182
70
183 @abc.abstractproperty
71 @abc.abstractproperty
184 def iopub_channel(self):
72 def iopub_channel(self):
185 pass
73 pass
186
74
187 @abc.abstractproperty
75 @abc.abstractproperty
188 def stdin_channel(self):
76 def stdin_channel(self):
189 pass
77 pass
190
78
191 @abc.abstractproperty
79 @abc.abstractproperty
192 def hb_channel(self):
80 def hb_channel(self):
193 pass
81 pass
General Comments 0
You need to be logged in to leave comments. Login now