##// END OF EJS Templates
More fixes to doc formatting
Thomas Kluyver -
Show More
@@ -102,7 +102,7 b' class KernelClient(LoggingConfigurable, ConnectionFileMixin):'
102 This will create the channels if they do not exist and then start
102 This will create the channels if they do not exist and then start
103 them (their activity runs in a thread). If port numbers of 0 are
103 them (their activity runs in a thread). If port numbers of 0 are
104 being used (random ports) then you must first call
104 being used (random ports) then you must first call
105 :method:`start_kernel`. If the channels have been stopped and you
105 :meth:`start_kernel`. If the channels have been stopped and you
106 call this, :class:`RuntimeError` will be raised.
106 call this, :class:`RuntimeError` will be raised.
107 """
107 """
108 if shell:
108 if shell:
@@ -527,11 +527,13 b' class Session(Configurable):'
527 Returns
527 Returns
528 -------
528 -------
529 msg_list : list
529 msg_list : list
530 The list of bytes objects to be sent with the format:
530 The list of bytes objects to be sent with the format::
531 [ident1,ident2,...,DELIM,HMAC,p_header,p_parent,p_metadata,p_content,
531
532 buffer1,buffer2,...]. In this list, the p_* entities are
532 [ident1, ident2, ..., DELIM, HMAC, p_header, p_parent,
533 the packed or serialized versions, so if JSON is used, these
533 p_metadata, p_content, buffer1, buffer2, ...]
534 are utf8 encoded JSON strings.
534
535 In this list, the ``p_*`` entities are the packed or serialized
536 versions, so if JSON is used, these are utf8 encoded JSON strings.
535 """
537 """
536 content = msg.get('content', {})
538 content = msg.get('content', {})
537 if content is None:
539 if content is None:
@@ -197,116 +197,116 b' class KernelMagics(Magics):'
197 temporary file and will execute the contents of this file when you
197 temporary file and will execute the contents of this file when you
198 close it (don't forget to save it!).
198 close it (don't forget to save it!).
199
199
200
201 Options:
200 Options:
202
201
203 -n <number>: open the editor at a specified line number. By default,
202 -n <number>
204 the IPython editor hook uses the unix syntax 'editor +N filename', but
203 Open the editor at a specified line number. By default, the IPython
205 you can configure this by providing your own modified hook if your
204 editor hook uses the unix syntax 'editor +N filename', but you can
206 favorite editor supports line-number specifications with a different
205 configure this by providing your own modified hook if your favorite
207 syntax.
206 editor supports line-number specifications with a different syntax.
208
207
209 -p: this will call the editor with the same data as the previous time
208 -p
210 it was used, regardless of how long ago (in your current session) it
209 Call the editor with the same data as the previous time it was used,
211 was.
210 regardless of how long ago (in your current session) it was.
212
211
213 -r: use 'raw' input. This option only applies to input taken from the
212 -r
214 user's history. By default, the 'processed' history is used, so that
213 Use 'raw' input. This option only applies to input taken from the
215 magics are loaded in their transformed version to valid Python. If
214 user's history. By default, the 'processed' history is used, so that
216 this option is given, the raw input as typed as the command line is
215 magics are loaded in their transformed version to valid Python. If
217 used instead. When you exit the editor, it will be executed by
216 this option is given, the raw input as typed as the command line is
218 IPython's own processor.
217 used instead. When you exit the editor, it will be executed by
219
218 IPython's own processor.
220 -x: do not execute the edited code immediately upon exit. This is
219
221 mainly useful if you are editing programs which need to be called with
220 -x
222 command line arguments, which you can then do using %run.
221 Do not execute the edited code immediately upon exit. This is mainly
223
222 useful if you are editing programs which need to be called with
223 command line arguments, which you can then do using %run.
224
224
225 Arguments:
225 Arguments:
226
226
227 If arguments are given, the following possibilites exist:
227 If arguments are given, the following possibilites exist:
228
228
229 - The arguments are numbers or pairs of colon-separated numbers (like
229 - The arguments are numbers or pairs of colon-separated numbers (like
230 1 4:8 9). These are interpreted as lines of previous input to be
230 1 4:8 9). These are interpreted as lines of previous input to be
231 loaded into the editor. The syntax is the same of the %macro command.
231 loaded into the editor. The syntax is the same of the %macro command.
232
232
233 - If the argument doesn't start with a number, it is evaluated as a
233 - If the argument doesn't start with a number, it is evaluated as a
234 variable and its contents loaded into the editor. You can thus edit
234 variable and its contents loaded into the editor. You can thus edit
235 any string which contains python code (including the result of
235 any string which contains python code (including the result of
236 previous edits).
236 previous edits).
237
237
238 - If the argument is the name of an object (other than a string),
238 - If the argument is the name of an object (other than a string),
239 IPython will try to locate the file where it was defined and open the
239 IPython will try to locate the file where it was defined and open the
240 editor at the point where it is defined. You can use `%edit function`
240 editor at the point where it is defined. You can use ``%edit function``
241 to load an editor exactly at the point where 'function' is defined,
241 to load an editor exactly at the point where 'function' is defined,
242 edit it and have the file be executed automatically.
242 edit it and have the file be executed automatically.
243
243
244 If the object is a macro (see %macro for details), this opens up your
244 If the object is a macro (see %macro for details), this opens up your
245 specified editor with a temporary file containing the macro's data.
245 specified editor with a temporary file containing the macro's data.
246 Upon exit, the macro is reloaded with the contents of the file.
246 Upon exit, the macro is reloaded with the contents of the file.
247
247
248 Note: opening at an exact line is only supported under Unix, and some
248 Note: opening at an exact line is only supported under Unix, and some
249 editors (like kedit and gedit up to Gnome 2.8) do not understand the
249 editors (like kedit and gedit up to Gnome 2.8) do not understand the
250 '+NUMBER' parameter necessary for this feature. Good editors like
250 '+NUMBER' parameter necessary for this feature. Good editors like
251 (X)Emacs, vi, jed, pico and joe all do.
251 (X)Emacs, vi, jed, pico and joe all do.
252
252
253 - If the argument is not found as a variable, IPython will look for a
253 - If the argument is not found as a variable, IPython will look for a
254 file with that name (adding .py if necessary) and load it into the
254 file with that name (adding .py if necessary) and load it into the
255 editor. It will execute its contents with execfile() when you exit,
255 editor. It will execute its contents with execfile() when you exit,
256 loading any code in the file into your interactive namespace.
256 loading any code in the file into your interactive namespace.
257
257
258 After executing your code, %edit will return as output the code you
258 After executing your code, %edit will return as output the code you
259 typed in the editor (except when it was an existing file). This way
259 typed in the editor (except when it was an existing file). This way
260 you can reload the code in further invocations of %edit as a variable,
260 you can reload the code in further invocations of %edit as a variable,
261 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
261 via ``_<NUMBER>` or ``Out[<NUMBER>]``, where <NUMBER> is the prompt number of
262 the output.
262 the output.
263
263
264 Note that %edit is also available through the alias %ed.
264 Note that %edit is also available through the alias %ed.
265
265
266 This is an example of creating a simple function inside the editor and
266 This is an example of creating a simple function inside the editor and
267 then modifying it. First, start up the editor:
267 then modifying it. First, start up the editor::
268
268
269 In [1]: ed
269 In [1]: ed
270 Editing... done. Executing edited code...
270 Editing... done. Executing edited code...
271 Out[1]: 'def foo():n print "foo() was defined in an editing session"n'
271 Out[1]: 'def foo():n print "foo() was defined in an editing session"n'
272
272
273 We can then call the function foo():
273 We can then call the function foo()::
274
274
275 In [2]: foo()
275 In [2]: foo()
276 foo() was defined in an editing session
276 foo() was defined in an editing session
277
277
278 Now we edit foo. IPython automatically loads the editor with the
278 Now we edit foo. IPython automatically loads the editor with the
279 (temporary) file where foo() was previously defined:
279 (temporary) file where foo() was previously defined::
280
280
281 In [3]: ed foo
281 In [3]: ed foo
282 Editing... done. Executing edited code...
282 Editing... done. Executing edited code...
283
283
284 And if we call foo() again we get the modified version:
284 And if we call foo() again we get the modified version::
285
285
286 In [4]: foo()
286 In [4]: foo()
287 foo() has now been changed!
287 foo() has now been changed!
288
288
289 Here is an example of how to edit a code snippet successive
289 Here is an example of how to edit a code snippet successive
290 times. First we call the editor:
290 times. First we call the editor::
291
291
292 In [5]: ed
292 In [5]: ed
293 Editing... done. Executing edited code...
293 Editing... done. Executing edited code...
294 hello
294 hello
295 Out[5]: "print 'hello'n"
295 Out[5]: "print 'hello'n"
296
296
297 Now we call it again with the previous output (stored in _):
297 Now we call it again with the previous output (stored in _)::
298
298
299 In [6]: ed _
299 In [6]: ed _
300 Editing... done. Executing edited code...
300 Editing... done. Executing edited code...
301 hello world
301 hello world
302 Out[6]: "print 'hello world'n"
302 Out[6]: "print 'hello world'n"
303
303
304 Now we call it with the output #8 (stored in _8, also as Out[8]):
304 Now we call it with the output #8 (stored in ``_8``, also as Out[8])::
305
305
306 In [7]: ed _8
306 In [7]: ed _8
307 Editing... done. Executing edited code...
307 Editing... done. Executing edited code...
308 hello again
308 hello again
309 Out[7]: "print 'hello again'n"
309 Out[7]: "print 'hello again'n"
310 """
310 """
311
311
312 opts,args = self.parse_options(parameter_s,'prn:')
312 opts,args = self.parse_options(parameter_s,'prn:')
@@ -360,13 +360,14 b' class BackgroundJobBase(threading.Thread):'
360 The derived classes must implement:
360 The derived classes must implement:
361
361
362 - Their own __init__, since the one here raises NotImplementedError. The
362 - Their own __init__, since the one here raises NotImplementedError. The
363 derived constructor must call self._init() at the end, to provide common
363 derived constructor must call self._init() at the end, to provide common
364 initialization.
364 initialization.
365
365
366 - A strform attribute used in calls to __str__.
366 - A strform attribute used in calls to __str__.
367
367
368 - A call() method, which will make the actual execution call and must
368 - A call() method, which will make the actual execution call and must
369 return a value to be held in the 'result' field of the job object."""
369 return a value to be held in the 'result' field of the job object.
370 """
370
371
371 # Class constants for status, in string and as numerical codes (when
372 # Class constants for status, in string and as numerical codes (when
372 # updating jobs lists, we don't want to do string comparisons). This will
373 # updating jobs lists, we don't want to do string comparisons). This will
@@ -378,6 +379,10 b' class BackgroundJobBase(threading.Thread):'
378 stat_dead_c = -1
379 stat_dead_c = -1
379
380
380 def __init__(self):
381 def __init__(self):
382 """Must be implemented in subclasses.
383
384 Subclasses must call :meth:`_init` for standard initialisation.
385 """
381 raise NotImplementedError("This class can not be instantiated directly.")
386 raise NotImplementedError("This class can not be instantiated directly.")
382
387
383 def _init(self):
388 def _init(self):
@@ -103,10 +103,13 b' class Exporter(LoggingConfigurable):'
103
103
104 Parameters
104 Parameters
105 ----------
105 ----------
106 nb : Notebook node
106 nb : :class:`~IPython.nbformat.v3.nbbase.NotebookNode`
107 resources : dict (**kw)
107 Notebook node
108 of additional resources that can be accessed read/write by
108 resources : dict
109 preprocessors.
109 Additional resources that can be accessed read/write by
110 preprocessors and filters.
111 **kw
112 Ignored (?)
110 """
113 """
111 nb_copy = copy.deepcopy(nb)
114 nb_copy = copy.deepcopy(nb)
112 resources = self._init_resources(resources)
115 resources = self._init_resources(resources)
@@ -193,10 +193,11 b' class TemplateExporter(Exporter):'
193
193
194 Parameters
194 Parameters
195 ----------
195 ----------
196 nb : Notebook node
196 nb : :class:`~IPython.nbformat.v3.nbbase.NotebookNode`
197 resources : dict (**kw)
197 Notebook node
198 of additional resources that can be accessed read/write by
198 resources : dict
199 preprocessors and filters.
199 Additional resources that can be accessed read/write by
200 preprocessors and filters.
200 """
201 """
201 nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
202 nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
202
203
@@ -1308,9 +1308,10 b' class HTCondorLauncher(BatchSystemLauncher):'
1308 this - the mechanism of shebanged scripts means that the python binary will be
1308 this - the mechanism of shebanged scripts means that the python binary will be
1309 launched with argv[0] set to the *location of the ip{cluster, engine, controller}
1309 launched with argv[0] set to the *location of the ip{cluster, engine, controller}
1310 scripts on the remote node*. This means you need to take care that:
1310 scripts on the remote node*. This means you need to take care that:
1311 a. Your remote nodes have their paths configured correctly, with the ipengine and ipcontroller
1311
1312 of the python environment you wish to execute code in having top precedence.
1312 a. Your remote nodes have their paths configured correctly, with the ipengine and ipcontroller
1313 b. This functionality is untested on Windows.
1313 of the python environment you wish to execute code in having top precedence.
1314 b. This functionality is untested on Windows.
1314
1315
1315 If you need different behavior, consider making you own template.
1316 If you need different behavior, consider making you own template.
1316 """
1317 """
@@ -31,7 +31,6 b' ipython_promptin:'
31 The default is 'In [%d]:'. This expects that the line numbers are used
31 The default is 'In [%d]:'. This expects that the line numbers are used
32 in the prompt.
32 in the prompt.
33 ipython_promptout:
33 ipython_promptout:
34
35 The string to represent the IPython prompt in the generated ReST. The
34 The string to represent the IPython prompt in the generated ReST. The
36 default is 'Out [%d]:'. This expects that the line numbers are used
35 default is 'Out [%d]:'. This expects that the line numbers are used
37 in the prompt.
36 in the prompt.
@@ -81,11 +81,12 b' def belong(candidates,checklist):'
81 def with_obj(object, **args):
81 def with_obj(object, **args):
82 """Set multiple attributes for an object, similar to Pascal's with.
82 """Set multiple attributes for an object, similar to Pascal's with.
83
83
84 Example:
84 Example::
85 with_obj(jim,
85
86 born = 1960,
86 with_obj(jim,
87 haircolour = 'Brown',
87 born = 1960,
88 eyecolour = 'Green')
88 haircolour = 'Brown',
89 eyecolour = 'Green')
89
90
90 Credit: Greg Ewing, in
91 Credit: Greg Ewing, in
91 http://mail.python.org/pipermail/python-list/2001-May/040703.html.
92 http://mail.python.org/pipermail/python-list/2001-May/040703.html.
General Comments 0
You need to be logged in to leave comments. Login now