##// END OF EJS Templates
Fixes to docs and InteractiveShell.instance()...
Brian Granger -
Show More
@@ -126,6 +126,9 b' class SeparateStr(Str):'
126 value = value.replace('\\n','\n')
126 value = value.replace('\\n','\n')
127 return super(SeparateStr, self).validate(obj, value)
127 return super(SeparateStr, self).validate(obj, value)
128
128
129 class MultipleInstanceError(Exception):
130 pass
131
129
132
130 #-----------------------------------------------------------------------------
133 #-----------------------------------------------------------------------------
131 # Main IPython class
134 # Main IPython class
@@ -268,14 +271,17 b' class InteractiveShell(Configurable, Magic):'
268 """Returns a global InteractiveShell instance."""
271 """Returns a global InteractiveShell instance."""
269 if not hasattr(cls, "_instance"):
272 if not hasattr(cls, "_instance"):
270 cls._instance = cls(*args, **kwargs)
273 cls._instance = cls(*args, **kwargs)
271 print cls
272 print cls._instance
273 # Now make sure that the instance will also be returned by
274 # Now make sure that the instance will also be returned by
274 # the subclasses instance attribute.
275 # the subclasses instance attribute.
275 for subclass in cls.mro():
276 for subclass in cls.mro()[1:]:
276 if issubclass(subclass, InteractiveShell):
277 if issubclass(subclass, InteractiveShell):
277 print subclass
278 if not hasattr(subclass, '_instance'):
278 subclass._instance = cls._instance
279 subclass._instance = cls._instance
280 else:
281 raise MultipleInstanceError(
282 'Multiple conflicting subclass of '
283 'InteractiveShell have been created.'
284 )
279 return cls._instance
285 return cls._instance
280
286
281 @classmethod
287 @classmethod
@@ -164,12 +164,6 b' Message type: ``execute_reply``::'
164 # One of: 'ok' OR 'error' OR 'abort'
164 # One of: 'ok' OR 'error' OR 'abort'
165 'status' : str,
165 'status' : str,
166
166
167 # Any additional data depends on status value
168 }
169
170 When status is 'ok', the following extra fields are present::
171
172 {
173 # This has the same structure as the output of a prompt request, but is
167 # This has the same structure as the output of a prompt request, but is
174 # for the client to set up the *next* prompt (with identical limitations
168 # for the client to set up the *next* prompt (with identical limitations
175 # to a prompt request)
169 # to a prompt request)
@@ -186,7 +180,11 b" When status is 'ok', the following extra fields are present::"
186 # to correct the previously written number in-place, terminal ones may
180 # to correct the previously written number in-place, terminal ones may
187 # re-print a corrected one if desired.
181 # re-print a corrected one if desired.
188 'prompt_number' : int,
182 'prompt_number' : int,
183 }
184
185 When status is 'ok', the following extra fields are present::
189
186
187 {
190 # The kernel will often transform the input provided to it. This
188 # The kernel will often transform the input provided to it. This
191 # contains the transformed code, which is what was actually executed.
189 # contains the transformed code, which is what was actually executed.
192 'transformed_code' : str,
190 'transformed_code' : str,
General Comments 0
You need to be logged in to leave comments. Login now