Show More
@@ -29,6 +29,7 b' from IPython.core.prefilter import ESC_MAGIC' | |||||
29 | from IPython.external.decorator import decorator |
|
29 | from IPython.external.decorator import decorator | |
30 | from IPython.utils.ipstruct import Struct |
|
30 | from IPython.utils.ipstruct import Struct | |
31 | from IPython.utils.process import arg_split |
|
31 | from IPython.utils.process import arg_split | |
|
32 | from IPython.utils.text import dedent | |||
32 | from IPython.utils.traitlets import Bool, Dict, Instance |
|
33 | from IPython.utils.traitlets import Bool, Dict, Instance | |
33 | from IPython.utils.warn import error, warn |
|
34 | from IPython.utils.warn import error, warn | |
34 |
|
35 | |||
@@ -110,7 +111,7 b' def validate_type(magic_kind):' | |||||
110 | _docstring_template = \ |
|
111 | _docstring_template = \ | |
111 | """Decorate the given {0} as {1} magic. |
|
112 | """Decorate the given {0} as {1} magic. | |
112 |
|
113 | |||
113 | The decorator can be used: |
|
114 | The decorator can be used with or without arguments, as follows. | |
114 |
|
115 | |||
115 | i) without arguments: it will create a {1} magic named as the {0} being |
|
116 | i) without arguments: it will create a {1} magic named as the {0} being | |
116 | decorated:: |
|
117 | decorated:: | |
@@ -209,7 +210,18 b' def _function_magic_marker(magic_kind):' | |||||
209 | return retval |
|
210 | return retval | |
210 |
|
211 | |||
211 | # Ensure the resulting decorator has a usable docstring |
|
212 | # Ensure the resulting decorator has a usable docstring | |
212 |
|
|
213 | ds = _docstring_template.format('function', magic_kind) | |
|
214 | ||||
|
215 | ds += dedent(""" | |||
|
216 | Note: this decorator can only be used in a context where IPython is already | |||
|
217 | active, so that the `get_ipython()` call succeeds. You can therefore use | |||
|
218 | it in your startup files loaded after IPython initializes, but *not* in the | |||
|
219 | IPython configuration file itself, which is executed before IPython is | |||
|
220 | fully up and running. Any file located in the `startup` subdirectory of | |||
|
221 | your configuration profile will be OK in this sense. | |||
|
222 | """) | |||
|
223 | ||||
|
224 | magic_deco.__doc__ = ds | |||
213 | return magic_deco |
|
225 | return magic_deco | |
214 |
|
226 | |||
215 |
|
227 |
General Comments 0
You need to be logged in to leave comments.
Login now