Show More
@@ -114,6 +114,7 b' class BasicMagics(Magics):' | |||
|
114 | 114 | Examples |
|
115 | 115 | -------- |
|
116 | 116 | :: |
|
117 | ||
|
117 | 118 | In [1]: %alias_magic t timeit |
|
118 | 119 | Created `%t` as an alias for `%timeit`. |
|
119 | 120 | Created `%%t` as an alias for `%%timeit`. |
@@ -68,6 +68,7 b' from IPython.core import magic_arguments' | |||
|
68 | 68 | from IPython.core.magic import Magics, magics_class, cell_magic |
|
69 | 69 | from IPython.utils import py3compat |
|
70 | 70 | from IPython.utils.path import get_ipython_cache_dir |
|
71 | from IPython.utils.text import dedent | |
|
71 | 72 | |
|
72 | 73 | import Cython |
|
73 | 74 | from Cython.Compiler.Errors import CompileError |
@@ -331,9 +332,12 b' class CythonMagics(Magics):' | |||
|
331 | 332 | return html |
|
332 | 333 | |
|
333 | 334 | __doc__ = __doc__.format( |
|
334 | CYTHON_DOC = ' '*8 + CythonMagics.cython.__doc__, | |
|
335 | CYTHON_INLINE_DOC = ' '*8 + CythonMagics.cython_inline.__doc__, | |
|
336 |
CYTHON_ |
|
|
335 | # rST doesn't see the -+ flag as part of an option list, so we | |
|
336 | # hide it from the module-level docstring. | |
|
337 | CYTHON_DOC = dedent(CythonMagics.cython.__doc__\ | |
|
338 | .replace('-+, --cplus','--cplus ')), | |
|
339 | CYTHON_INLINE_DOC = dedent(CythonMagics.cython_inline.__doc__), | |
|
340 | CYTHON_PYXIMPORT_DOC = dedent(CythonMagics.cython_pyximport.__doc__), | |
|
337 | 341 | ) |
|
338 | 342 | |
|
339 | 343 | def load_ipython_extension(ip): |
@@ -55,6 +55,7 b' from IPython.core.magic_arguments import (' | |||
|
55 | 55 | argument, magic_arguments, parse_argstring |
|
56 | 56 | ) |
|
57 | 57 | from IPython.utils.py3compat import unicode_to_str |
|
58 | from IPython.utils.text import dedent | |
|
58 | 59 | |
|
59 | 60 | class OctaveMagicError(oct2py.Oct2PyError): |
|
60 | 61 | pass |
@@ -145,6 +146,8 b' class OctaveMagics(Magics):' | |||
|
145 | 146 | ''' |
|
146 | 147 | Line-level magic that pulls a variable from Octave. |
|
147 | 148 | |
|
149 | :: | |
|
150 | ||
|
148 | 151 | In [18]: _ = %octave x = [1 2; 3 4]; y = 'hello' |
|
149 | 152 | |
|
150 | 153 | In [19]: %octave_pull x y |
@@ -195,7 +198,7 b' class OctaveMagics(Magics):' | |||
|
195 | 198 | def octave(self, line, cell=None, local_ns=None): |
|
196 | 199 | ''' |
|
197 | 200 | Execute code in Octave, and pull some of the results back into the |
|
198 |
Python namespace |
|
|
201 | Python namespace:: | |
|
199 | 202 | |
|
200 | 203 | In [9]: %octave X = [1 2; 3 4]; mean(X) |
|
201 | 204 | Out[9]: array([[ 2., 3.]]) |
@@ -209,9 +212,9 b' class OctaveMagics(Magics):' | |||
|
209 | 212 | |
|
210 | 213 | -2*x^4 - 1*x^3 + 0*x^2 + 1*x^1 + 2 |
|
211 | 214 | |
|
212 | In the notebook, plots are published as the output of the cell, e.g. | |
|
215 | In the notebook, plots are published as the output of the cell, e.g.:: | |
|
213 | 216 | |
|
214 | %octave plot([1 2 3], [4 5 6]) | |
|
217 | %octave plot([1 2 3], [4 5 6]) | |
|
215 | 218 | |
|
216 | 219 | will create a line plot. |
|
217 | 220 | |
@@ -360,9 +363,9 b' class OctaveMagics(Magics):' | |||
|
360 | 363 | |
|
361 | 364 | |
|
362 | 365 | __doc__ = __doc__.format( |
|
363 |
OCTAVE_DOC = |
|
|
364 |
OCTAVE_PUSH_DOC = |
|
|
365 |
OCTAVE_PULL_DOC = |
|
|
366 | OCTAVE_DOC = dedent(OctaveMagics.octave.__doc__), | |
|
367 | OCTAVE_PUSH_DOC = dedent(OctaveMagics.octave_push.__doc__), | |
|
368 | OCTAVE_PULL_DOC = dedent(OctaveMagics.octave_pull.__doc__) | |
|
366 | 369 | ) |
|
367 | 370 | |
|
368 | 371 |
@@ -75,6 +75,7 b' from IPython.core.magic_arguments import (' | |||
|
75 | 75 | from IPython.external.simplegeneric import generic |
|
76 | 76 | from IPython.utils.py3compat import (str_to_unicode, unicode_to_str, PY3, |
|
77 | 77 | unicode_type) |
|
78 | from IPython.utils.text import dedent | |
|
78 | 79 | |
|
79 | 80 | class RInterpreterError(ri.RRuntimeError): |
|
80 | 81 | """An error when running R code in a %%R magic cell.""" |
@@ -679,10 +680,10 b' class RMagics(Magics):' | |||
|
679 | 680 | return self.Rconverter(result, dataframe=False) |
|
680 | 681 | |
|
681 | 682 | __doc__ = __doc__.format( |
|
682 |
R_DOC = |
|
|
683 |
RPUSH_DOC = |
|
|
684 |
RPULL_DOC = |
|
|
685 |
RGET_DOC = |
|
|
683 | R_DOC = dedent(RMagics.R.__doc__), | |
|
684 | RPUSH_DOC = dedent(RMagics.Rpush.__doc__), | |
|
685 | RPULL_DOC = dedent(RMagics.Rpull.__doc__), | |
|
686 | RGET_DOC = dedent(RMagics.Rget.__doc__) | |
|
686 | 687 | ) |
|
687 | 688 | |
|
688 | 689 |
@@ -46,6 +46,7 b' from IPython.core.error import UsageError' | |||
|
46 | 46 | from IPython.core.magic import Magics |
|
47 | 47 | from IPython.core import magic_arguments |
|
48 | 48 | from IPython.testing.skipdoctest import skip_doctest |
|
49 | from IPython.utils.text import dedent | |
|
49 | 50 | |
|
50 | 51 | #----------------------------------------------------------------------------- |
|
51 | 52 | # Definitions of magic functions for use with IPython |
@@ -108,13 +109,11 b' def output_args(f):' | |||
|
108 | 109 | |
|
109 | 110 | Choices are: |
|
110 | 111 | |
|
111 | type: group outputs of all engines by type (stdout, stderr, displaypub, etc.). | |
|
112 | ||
|
113 |
|
|
|
114 | ||
|
115 | order: like type, but individual displaypub output from each engine is collated. | |
|
116 | For example, if multiple plots are generated by each engine, the first | |
|
117 | figure of each engine will be displayed, then the second of each, etc. | |
|
112 | **type**: group outputs of all engines by type (stdout, stderr, displaypub, etc.). | |
|
113 | **engine**: display all output for each engine together. | |
|
114 | **order**: like type, but individual displaypub output from each engine is collated. | |
|
115 | For example, if multiple plots are generated by each engine, the first | |
|
116 | figure of each engine will be displayed, then the second of each, etc. | |
|
118 | 117 | """ |
|
119 | 118 | ), |
|
120 | 119 | magic_arguments.argument('-o', '--out', dest='save_name', type=str, |
@@ -435,8 +434,8 b' class ParallelMagics(Magics):' | |||
|
435 | 434 | |
|
436 | 435 | |
|
437 | 436 | __doc__ = __doc__.format( |
|
438 |
AUTOPX_DOC = |
|
|
439 |
PX_DOC = |
|
|
440 |
RESULT_DOC = |
|
|
441 |
CONFIG_DOC = |
|
|
437 | AUTOPX_DOC = dedent(ParallelMagics.autopx.__doc__), | |
|
438 | PX_DOC = dedent(ParallelMagics.px.__doc__), | |
|
439 | RESULT_DOC = dedent(ParallelMagics.result.__doc__), | |
|
440 | CONFIG_DOC = dedent(ParallelMagics.pxconfig.__doc__), | |
|
442 | 441 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now