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