diff --git a/IPython/Magic.py b/IPython/Magic.py index 47f9d15..3b6558a 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -2253,7 +2253,7 @@ Currently the magic system has the following functions:\n""" If you wish to write your own editor hook, you can put it in a configuration file which you load at startup time. The default hook - is defined in the IPython.hooks module, and you can use that as a + is defined in the IPython.core.hooks module, and you can use that as a starting example for further modifications. That file also has general instructions on how to set a new hook for use once you've defined it.""" diff --git a/IPython/hooks.py b/IPython/core/hooks.py similarity index 100% rename from IPython/hooks.py rename to IPython/core/hooks.py diff --git a/IPython/core/tests/test_imports.py b/IPython/core/tests/test_imports.py index 8f3824f..848c359 100644 --- a/IPython/core/tests/test_imports.py +++ b/IPython/core/tests/test_imports.py @@ -16,3 +16,11 @@ def test_import_fakemodule(): def test_import_excolors(): from IPython.core import excolors +def test_import_history(): + from IPython.core import history + +def test_import_hooks(): + from IPython.core import hooks + + + diff --git a/IPython/iplib.py b/IPython/iplib.py index 16553dd..d44c015 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -626,7 +626,8 @@ class InteractiveShell(object,Magic): self.strdispatchers = {} # Set all default hooks, defined in the IPython.hooks module. - hooks = IPython.hooks + import IPython.core.hooks + hooks = IPython.core.hooks for hook_name in hooks.__all__: # default hooks have priority 100, i.e. low; user hooks should have # 0-100 priority @@ -1019,10 +1020,10 @@ class InteractiveShell(object,Magic): return dp = getattr(self.hooks, name, None) - if name not in IPython.hooks.__all__: - print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ ) + if name not in IPython.core.hooks.__all__: + print "Warning! Hook '%s' is not one of %s" % (name, IPython.core.hooks.__all__ ) if not dp: - dp = IPython.hooks.CommandChainDispatcher() + dp = IPython.core.hooks.CommandChainDispatcher() try: dp.add(f,priority) diff --git a/IPython/strdispatch.py b/IPython/strdispatch.py index 7113537..c03c282 100644 --- a/IPython/strdispatch.py +++ b/IPython/strdispatch.py @@ -5,8 +5,7 @@ import re # Our own modules -from IPython.hooks import CommandChainDispatcher -import IPython.hooks +from IPython.core.hooks import CommandChainDispatcher # Code begins class StrDispatch(object): diff --git a/docs/source/development/reorg.txt b/docs/source/development/reorg.txt index 6c46cc6..9f36b55 100644 --- a/docs/source/development/reorg.txt +++ b/docs/source/development/reorg.txt @@ -131,6 +131,8 @@ Where things will be moved * :file:`history.py`. Move to :file:`IPython.core`. +* :file:`hooks.py`. Move to :file:`IPython.core`. + * :file:`Itpl.py`. Remove. Version already in :file:`IPython.external`. @@ -172,7 +174,7 @@ Where things will be moved -* :file:`hooks.py`. Move to :file:`IPython.core`. + * :file:`ipapi.py`. Move to :file:`IPython.core`.