Show More
@@ -22,6 +22,7 b' import __future__' | |||||
22 | import abc |
|
22 | import abc | |
23 | import ast |
|
23 | import ast | |
24 | import atexit |
|
24 | import atexit | |
|
25 | import functools | |||
25 | import os |
|
26 | import os | |
26 | import re |
|
27 | import re | |
27 | import runpy |
|
28 | import runpy | |
@@ -2028,7 +2029,6 b' class InteractiveShell(SingletonConfigurable):' | |||||
2028 |
|
2029 | |||
2029 | # Expose as public API from the magics manager |
|
2030 | # Expose as public API from the magics manager | |
2030 | self.register_magics = self.magics_manager.register |
|
2031 | self.register_magics = self.magics_manager.register | |
2031 | self.register_magic_function = self.magics_manager.register_function |
|
|||
2032 | self.define_magic = self.magics_manager.define_magic |
|
2032 | self.define_magic = self.magics_manager.define_magic | |
2033 |
|
2033 | |||
2034 | self.register_magics(m.AutoMagics, m.BasicMagics, m.CodeMagics, |
|
2034 | self.register_magics(m.AutoMagics, m.BasicMagics, m.CodeMagics, | |
@@ -2053,6 +2053,12 b' class InteractiveShell(SingletonConfigurable):' | |||||
2053 | # even need a centralize colors management object. |
|
2053 | # even need a centralize colors management object. | |
2054 | self.magic('colors %s' % self.colors) |
|
2054 | self.magic('colors %s' % self.colors) | |
2055 |
|
2055 | |||
|
2056 | # Defined here so that it's included in the documentation | |||
|
2057 | @functools.wraps(magic.MagicsManager.register_function) | |||
|
2058 | def register_magic_function(self, func, magic_kind='line', magic_name=None): | |||
|
2059 | self.magics_manager.register_function(func, | |||
|
2060 | magic_kind=magic_kind, magic_name=magic_name) | |||
|
2061 | ||||
2056 | def run_line_magic(self, magic_name, line): |
|
2062 | def run_line_magic(self, magic_name, line): | |
2057 | """Execute the given line magic. |
|
2063 | """Execute the given line magic. | |
2058 |
|
2064 |
@@ -57,7 +57,7 b' IPython at that point.' | |||||
57 | the extension again. It is up to the extension author to add code to manage |
|
57 | the extension again. It is up to the extension author to add code to manage | |
58 | that. |
|
58 | that. | |
59 |
|
59 | |||
60 |
Useful :class:`InteractiveShell` methods include :meth:`~IPython.core.interactiveshell.InteractiveShell. |
|
60 | Useful :class:`InteractiveShell` methods include :meth:`~IPython.core.interactiveshell.InteractiveShell.register_magic_function`, | |
61 | :meth:`~IPython.core.interactiveshell.InteractiveShell.push` (to add variables to the user namespace) and |
|
61 | :meth:`~IPython.core.interactiveshell.InteractiveShell.push` (to add variables to the user namespace) and | |
62 | :meth:`~IPython.core.interactiveshell.InteractiveShell.drop_by_id` (to remove variables on unloading). |
|
62 | :meth:`~IPython.core.interactiveshell.InteractiveShell.drop_by_id` (to remove variables on unloading). | |
63 |
|
63 |
General Comments 0
You need to be logged in to leave comments.
Login now