Show More
@@ -203,7 +203,8 class Kernel(Configurable): | |||
|
203 | 203 | reply_content['prompt_number'] = prompt_number |
|
204 | 204 | prompt_string = self.shell.displayhook.prompt1.peek_next_prompt() |
|
205 | 205 | next_prompt = {'prompt_string' : prompt_string, |
|
206 |
'prompt_number' : prompt_number+1 |
|
|
206 | 'prompt_number' : prompt_number+1, | |
|
207 | 'input_sep' : self.shell.displayhook.input_sep} | |
|
207 | 208 | reply_content['next_prompt'] = next_prompt |
|
208 | 209 | |
|
209 | 210 | # Flush output before sending the reply. |
@@ -101,8 +101,8 generic structure:: | |||
|
101 | 101 | # messages in a meaningful way. |
|
102 | 102 | 'header' : { 'msg_id' : uuid, |
|
103 | 103 | 'username' : str, |
|
104 |
|
|
|
105 | }, | |
|
104 | 'session' : uuid | |
|
105 | }, | |
|
106 | 106 | |
|
107 | 107 | # In a chain of messages, the header from the parent is copied so that |
|
108 | 108 | # clients can track where messages come from. |
@@ -142,17 +142,17 Message type: ``execute_request``:: | |||
|
142 | 142 | |
|
143 | 143 | content = { |
|
144 | 144 | # Source code to be executed by the kernel, one or more lines. |
|
145 |
|
|
|
146 | ||
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
145 | 'code' : str, | |
|
146 | ||
|
147 | # A boolean flag which, if True, signals the kernel to execute this | |
|
148 | # code as quietly as possible. This means that the kernel will compile | |
|
149 | # the code with 'exec' instead of 'single' (so sys.displayhook will not | |
|
150 | # fire), and will *not*: | |
|
151 | # - broadcast exceptions on the PUB socket | |
|
152 | # - do any logging | |
|
153 | # - populate any history | |
|
154 | # The default is False. | |
|
155 | 'silent' : bool, | |
|
156 | 156 | } |
|
157 | 157 | |
|
158 | 158 | Upon execution, the kernel *always* sends a reply, with a status code |
@@ -169,9 +169,10 Message type: ``execute_reply``:: | |||
|
169 | 169 | # to a prompt request) |
|
170 | 170 | 'next_prompt' : { |
|
171 | 171 | 'prompt_string' : str, |
|
172 |
|
|
|
173 | }, | |
|
174 |
|
|
|
172 | 'prompt_number' : int, | |
|
173 | 'input_sep' : str | |
|
174 | }, | |
|
175 | ||
|
175 | 176 | # The prompt number of the actual execution for this code, which may be |
|
176 | 177 | # different from the one used when the code was typed, which was the |
|
177 | 178 | # 'next_prompt' field of the *previous* request. They will differ in the |
@@ -272,12 +273,12 Message type: ``object_info_request``:: | |||
|
272 | 273 | |
|
273 | 274 | content = { |
|
274 | 275 | # The (possibly dotted) name of the object to be searched in all |
|
275 |
|
|
|
276 |
|
|
|
276 | # relevant namespaces | |
|
277 | 'name' : str, | |
|
277 | 278 | |
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
|
279 | # The level of detail desired. The default (0) is equivalent to typing | |
|
280 | # 'x?' at the prompt, 1 is equivalent to 'x??'. | |
|
281 | 'detail_level' : int, | |
|
281 | 282 | } |
|
282 | 283 | |
|
283 | 284 | The returned information will be a dictionary with keys very similar to the |
@@ -287,51 +288,51 Message type: ``object_info_reply``:: | |||
|
287 | 288 | |
|
288 | 289 | content = { |
|
289 | 290 | # Flags for magics and system aliases |
|
290 |
|
|
|
291 |
|
|
|
292 | ||
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
|
296 | ||
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 | ||
|
301 |
|
|
|
302 | ||
|
303 |
|
|
|
304 |
|
|
|
305 | ||
|
306 |
|
|
|
307 |
|
|
|
308 | ||
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 | ||
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 | ||
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 | ||
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 | ||
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
330 | ||
|
331 |
|
|
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
|
291 | 'ismagic' : bool, | |
|
292 | 'isalias' : bool, | |
|
293 | ||
|
294 | # The name of the namespace where the object was found ('builtin', | |
|
295 | # 'magics', 'alias', 'interactive', etc.) | |
|
296 | 'namespace' : str, | |
|
297 | ||
|
298 | # The type name will be type.__name__ for normal Python objects, but it | |
|
299 | # can also be a string like 'Magic function' or 'System alias' | |
|
300 | 'type_name' : str, | |
|
301 | ||
|
302 | 'string_form' : str, | |
|
303 | ||
|
304 | # For objects with a __class__ attribute this will be set | |
|
305 | 'base_class' : str, | |
|
306 | ||
|
307 | # For objects with a __len__ attribute this will be set | |
|
308 | 'length' : int, | |
|
309 | ||
|
310 | # If the object is a function, class or method whose file we can find, | |
|
311 | # we give its full path | |
|
312 | 'file' : str, | |
|
313 | ||
|
314 | # For pure Python callable objects, we can reconstruct the object | |
|
315 | # definition line which provides its call signature | |
|
316 | 'definition' : str, | |
|
317 | ||
|
318 | # For instances, provide the constructor signature (the definition of | |
|
319 | # the __init__ method): | |
|
320 | 'init_definition' : str, | |
|
321 | ||
|
322 | # Docstrings: for any object (function, method, module, package) with a | |
|
323 | # docstring, we show it. But in addition, we may provide additional | |
|
324 | # docstrings. For example, for instances we will show the constructor | |
|
325 | # and class docstrings as well, if available. | |
|
326 | 'docstring' : str, | |
|
327 | ||
|
328 | # For instances, provide the constructor and class docstrings | |
|
329 | 'init_docstring' : str, | |
|
330 | 'class_docstring' : str, | |
|
331 | ||
|
332 | # If detail_level was 1, we also try to find the source code that | |
|
333 | # defines the object, if possible. The string 'None' will indicate | |
|
334 | # that no source was found. | |
|
335 | 'source' : str, | |
|
335 | 336 | } |
|
336 | 337 | |
|
337 | 338 | |
@@ -342,20 +343,20 Message type: ``complete_request``:: | |||
|
342 | 343 | |
|
343 | 344 | content = { |
|
344 | 345 | # The text to be completed, such as 'a.is' |
|
345 |
|
|
|
346 | 'text' : str, | |
|
346 | 347 | |
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
348 | # The full line, such as 'print a.is'. This allows completers to | |
|
349 | # make decisions that may require information about more than just the | |
|
350 | # current word. | |
|
351 | 'line' : str, | |
|
351 | 352 | } |
|
352 | 353 | |
|
353 | 354 | Message type: ``complete_reply``:: |
|
354 | 355 | |
|
355 | 356 | content = { |
|
356 | 357 | # The list of all matches to the completion request, such as |
|
357 |
|
|
|
358 |
|
|
|
358 | # ['a.isalnum', 'a.isalpha'] for the above example. | |
|
359 | 'matches' : list | |
|
359 | 360 | } |
|
360 | 361 | |
|
361 | 362 | |
@@ -406,10 +407,10 Message type: ``stream``:: | |||
|
406 | 407 | |
|
407 | 408 | content = { |
|
408 | 409 | # The name of the stream is one of 'stdin', 'stdout', 'stderr' |
|
409 |
|
|
|
410 | ||
|
411 |
|
|
|
412 |
|
|
|
410 | 'name' : str, | |
|
411 | ||
|
412 | # The data is an arbitrary string to be written to that stream | |
|
413 | 'data' : str, | |
|
413 | 414 | } |
|
414 | 415 | |
|
415 | 416 | When a kernel receives a raw_input call, it should also broadcast it on the pub |
@@ -426,7 +427,7 Message type: ``pyin``:: | |||
|
426 | 427 | |
|
427 | 428 | content = { |
|
428 | 429 | # Source code to be executed, one or more lines |
|
429 |
|
|
|
430 | 'code' : str | |
|
430 | 431 | } |
|
431 | 432 | |
|
432 | 433 | Python outputs |
@@ -446,12 +447,12 Message type: ``pyout``:: | |||
|
446 | 447 | |
|
447 | 448 | content = { |
|
448 | 449 | # The data is typically the repr() of the object. |
|
449 |
|
|
|
450 | ||
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
|
450 | 'data' : str, | |
|
451 | ||
|
452 | # The prompt number for this execution is also provided so that clients | |
|
453 | # can display it, since IPython automatically creates variables called | |
|
454 | # _N (for prompt N). | |
|
455 | 'prompt_number' : int, | |
|
455 | 456 | } |
|
456 | 457 | |
|
457 | 458 | Python errors |
@@ -494,9 +495,9 Other potential message types, currently unimplemented, listed below as ideas. | |||
|
494 | 495 | Message type: ``file``:: |
|
495 | 496 | |
|
496 | 497 | content = { |
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
498 | 'path' : 'cool.jpg', | |
|
499 | 'mimetype' : str, | |
|
500 | 'data' : str, | |
|
500 | 501 | } |
|
501 | 502 | |
|
502 | 503 |
General Comments 0
You need to be logged in to leave comments.
Login now