From 3b7a36a1f116cf72932713599ab2fa0b5ed93710 2009-07-02 04:31:54 From: Brian Granger Date: 2009-07-02 04:31:54 Subject: [PATCH] iplib.py => core/iplib.py and updated tests and imports. --- diff --git a/IPython/Extensions/InterpreterExec.py b/IPython/Extensions/InterpreterExec.py index 9624e0c..f3f4ede 100644 --- a/IPython/Extensions/InterpreterExec.py +++ b/IPython/Extensions/InterpreterExec.py @@ -43,7 +43,7 @@ def prefilter_shell(self,line,continuation): return self._prefilter(line,continuation) # Rebind this to be the new IPython prefilter: -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell InteractiveShell.prefilter = prefilter_shell # Clean up the namespace. del InteractiveShell,prefilter_shell diff --git a/IPython/Extensions/InterpreterPasteInput.py b/IPython/Extensions/InterpreterPasteInput.py index d16c911..3948b63 100644 --- a/IPython/Extensions/InterpreterPasteInput.py +++ b/IPython/Extensions/InterpreterPasteInput.py @@ -85,7 +85,7 @@ Authors import re -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell PROMPT_RE = re.compile(r'(^[ \t]*>>> |^[ \t]*\.\.\. )') diff --git a/IPython/Extensions/PhysicalQInput.py b/IPython/Extensions/PhysicalQInput.py index 04f05c0..fd53e8a 100644 --- a/IPython/Extensions/PhysicalQInput.py +++ b/IPython/Extensions/PhysicalQInput.py @@ -52,7 +52,7 @@ def prefilter_PQ(self,line,continuation): imported.""" from re import match - from IPython.iplib import InteractiveShell + from IPython.core.iplib import InteractiveShell # This regexp is what does the real work unit_split = match(r'\s*(\w+)\s*=\s*(-?\d*\.?\d*[eE]?-?\d*)\s+([a-zA-Z].*)', @@ -74,7 +74,7 @@ def prefilter_PQ(self,line,continuation): return InteractiveShell._prefilter(self,line,continuation) # Rebind this to be the new IPython prefilter: -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell InteractiveShell.prefilter = prefilter_PQ # Clean up the namespace. diff --git a/IPython/Magic.py b/IPython/Magic.py index 02e4ff7..4c26e0b 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -3309,7 +3309,7 @@ Defaulting color scheme to 'NoColor'""" strip_from_start = map(re.compile,strip_re) - from IPython import iplib + from IPython.core import iplib lines = [] print "Pasting code; enter '%s' alone on the line to stop." % sentinel while 1: diff --git a/IPython/Shell.py b/IPython/Shell.py index 3536d35..a4eed7f 100644 --- a/IPython/Shell.py +++ b/IPython/Shell.py @@ -38,7 +38,7 @@ from IPython import ultraTB from IPython.core import ipapi from IPython.Magic import Magic from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell from IPython.ipmaker import make_IPython from IPython.ipstruct import Struct from IPython.testing import decorators as testdec diff --git a/IPython/UserConfig/ipythonrc b/IPython/UserConfig/ipythonrc index b530bb7..c9e9284 100644 --- a/IPython/UserConfig/ipythonrc +++ b/IPython/UserConfig/ipythonrc @@ -593,8 +593,8 @@ execfile # execfile example-magic.py -# Look at the examples in IPython/iplib.py for more details on how these magic -# functions need to process their arguments. +# Look at the examples in IPython/core/iplib.py for more details on how +# these magic functions need to process their arguments. #--------------------------------------------------------------------------- # Section: aliases for system shell commands diff --git a/IPython/iplib.py b/IPython/core/iplib.py similarity index 100% rename from IPython/iplib.py rename to IPython/core/iplib.py diff --git a/IPython/core/tests/test_imports.py b/IPython/core/tests/test_imports.py index 8e3be84..d994268 100644 --- a/IPython/core/tests/test_imports.py +++ b/IPython/core/tests/test_imports.py @@ -25,5 +25,9 @@ def test_import_hooks(): def test_import_ipapi(): from IPython.core import ipapi +def test_imort_iplib(): + from IPython.core import iplib + + diff --git a/IPython/tests/test_iplib.py b/IPython/core/tests/test_iplib.py similarity index 98% rename from IPython/tests/test_iplib.py rename to IPython/core/tests/test_iplib.py index beb3de4..798743e 100644 --- a/IPython/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -13,7 +13,7 @@ import tempfile import nose.tools as nt # our own packages -from IPython import iplib +from IPython.core import iplib from IPython.core import ipapi #----------------------------------------------------------------------------- diff --git a/IPython/deathrow/GnuplotInteractive.py b/IPython/deathrow/GnuplotInteractive.py index c7f45d2..cc9dd7b 100644 --- a/IPython/deathrow/GnuplotInteractive.py +++ b/IPython/deathrow/GnuplotInteractive.py @@ -140,7 +140,7 @@ else: print """*** Type `gphelp` for help on the Gnuplot integration features.""" # Add the new magic functions to the class dict - from IPython.iplib import InteractiveShell + from IPython.core.iplib import InteractiveShell InteractiveShell.magic_gpc = magic_gpc InteractiveShell.magic_gp_set_default = magic_gp_set_default diff --git a/IPython/deathrow/twshell.py b/IPython/deathrow/twshell.py index 08f699e..98c2d81 100644 --- a/IPython/deathrow/twshell.py +++ b/IPython/deathrow/twshell.py @@ -7,7 +7,7 @@ import sys from twisted.internet import reactor, threads from IPython.ipmaker import make_IPython -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell from IPython.ipstruct import Struct import Queue,thread,threading,signal from signal import signal, SIGINT diff --git a/IPython/frontend/prefilterfrontend.py b/IPython/frontend/prefilterfrontend.py index b0af0bb..5892cdc 100644 --- a/IPython/frontend/prefilterfrontend.py +++ b/IPython/frontend/prefilterfrontend.py @@ -80,7 +80,7 @@ class PrefilterFrontEnd(LineFrontEndBase): # on exceptions (https://bugs.launchpad.net/bugs/337105) # XXX: This is horrible: module-leve monkey patching -> side # effects. - from IPython import iplib + from IPython.core import iplib iplib.InteractiveShell.isthreaded = True LineFrontEndBase.__init__(self, *args, **kwargs) diff --git a/IPython/frontend/tests/test_prefilterfrontend.py b/IPython/frontend/tests/test_prefilterfrontend.py index beabde8..6a9cd3a 100644 --- a/IPython/frontend/tests/test_prefilterfrontend.py +++ b/IPython/frontend/tests/test_prefilterfrontend.py @@ -84,7 +84,7 @@ def isolate_ipython0(func): ipython0.user_ns = user_ns ipython0.user_global_ns = global_ns # Undo the hack at creation of PrefilterFrontEnd - from IPython import iplib + from IPythoncore. import iplib iplib.InteractiveShell.isthreaded = False return out diff --git a/IPython/gui/wx/ipshell_nonblocking.py b/IPython/gui/wx/ipshell_nonblocking.py index ab879e2..5dd611c 100644 --- a/IPython/gui/wx/ipshell_nonblocking.py +++ b/IPython/gui/wx/ipshell_nonblocking.py @@ -26,6 +26,7 @@ from thread_ex import ThreadEx try: import IPython from IPython.utils import genutils + from IPython.core import iplib except Exception,e: print "Error importing IPython (%s)" % str(e) raise Exception, e @@ -177,7 +178,7 @@ class NonBlockingIPShell(object): self._IP.set_hook('shell_hook', self._shell) #we replace the ipython default input command caller by our method - IPython.iplib.raw_input_original = self._raw_input_original + iplib.raw_input_original = self._raw_input_original #we replace the ipython default exit command by our method self._IP.exit = ask_exit_handler #we replace the help command diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index 675f13b..76ca63e 100644 --- a/IPython/ipmaker.py +++ b/IPython/ipmaker.py @@ -49,7 +49,7 @@ from IPython import Release from IPython.ipstruct import Struct from IPython.OutputTrap import OutputTrap from IPython.config.configloader import ConfigLoader -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell from IPython.usage import cmd_line_usage,interactive_usage from IPython.utils.genutils import * diff --git a/IPython/kernel/magic.py b/IPython/kernel/magic.py index 980c63b..30b4794 100644 --- a/IPython/kernel/magic.py +++ b/IPython/kernel/magic.py @@ -17,7 +17,7 @@ __docformat__ = "restructuredtext en" import new -from IPython.iplib import InteractiveShell +from IPython.core.iplib import InteractiveShell from IPython.Shell import MTInteractiveShell from twisted.internet.defer import Deferred diff --git a/IPython/kernel/scripts/ipcluster.py b/IPython/kernel/scripts/ipcluster.py index 14fc4c9..e668519 100755 --- a/IPython/kernel/scripts/ipcluster.py +++ b/IPython/kernel/scripts/ipcluster.py @@ -39,7 +39,7 @@ from IPython.kernel.fcutil import have_crypto # Create various ipython directories if they don't exist. # This must be done before IPython.kernel.config is imported. -from IPython.iplib import user_setup +from IPython.core.iplib import user_setup if os.name == 'posix': rc_suffix = '' else: diff --git a/IPython/kernel/scripts/ipcontroller.py b/IPython/kernel/scripts/ipcontroller.py index fafe39e..45fa612 100755 --- a/IPython/kernel/scripts/ipcontroller.py +++ b/IPython/kernel/scripts/ipcontroller.py @@ -41,7 +41,7 @@ from IPython.kernel.fcutil import check_furl_file_security # Create various ipython directories if they don't exist. # This must be done before IPython.kernel.config is imported. -from IPython.iplib import user_setup +from IPython.core.iplib import user_setup from IPython.utils.genutils import get_ipython_dir, get_log_dir, get_security_dir if os.name == 'posix': rc_suffix = '' diff --git a/IPython/kernel/scripts/ipengine.py b/IPython/kernel/scripts/ipengine.py index 7ce7cd0..2210b11 100755 --- a/IPython/kernel/scripts/ipengine.py +++ b/IPython/kernel/scripts/ipengine.py @@ -36,7 +36,7 @@ from IPython.kernel.engineservice import EngineService # Create various ipython directories if they don't exist. # This must be done before IPython.kernel.config is imported. -from IPython.iplib import user_setup +from IPython.core.iplib import user_setup from IPython.utils.genutils import get_ipython_dir, get_log_dir, get_security_dir if os.name == 'posix': rc_suffix = '' diff --git a/IPython/testing/plugin/Makefile b/IPython/testing/plugin/Makefile index dec6a23..c6e191d 100644 --- a/IPython/testing/plugin/Makefile +++ b/IPython/testing/plugin/Makefile @@ -40,7 +40,7 @@ excolors: plugin $(NOSE) IPython.core.excolors iplib: plugin - $(NOSE) IPython.iplib + $(NOSE) IPython.core.iplib strd: plugin $(NOSE) IPython.strdispatch diff --git a/IPython/testing/plugin/ipdoctest.py b/IPython/testing/plugin/ipdoctest.py index c7ff73e..b4e5fdf 100644 --- a/IPython/testing/plugin/ipdoctest.py +++ b/IPython/testing/plugin/ipdoctest.py @@ -195,7 +195,7 @@ def start_ipython(): # So that ipython magics and aliases can be doctested (they work by making # a call into a global _ip object) - _ip = IPython.ipapi.get() + _ip = ipapi.get() __builtin__._ip = _ip # Modify the IPython system call with one that uses getoutput, so that we diff --git a/docs/source/development/reorg.txt b/docs/source/development/reorg.txt index 9f36b55..81d7df7 100644 --- a/docs/source/development/reorg.txt +++ b/docs/source/development/reorg.txt @@ -133,6 +133,9 @@ Where things will be moved * :file:`hooks.py`. Move to :file:`IPython.core`. +* :file:`ipapi.py`. Move to :file:`IPython.core`. + + * :file:`Itpl.py`. Remove. Version already in :file:`IPython.external`. @@ -176,7 +179,7 @@ Where things will be moved -* :file:`ipapi.py`. Move to :file:`IPython.core`. + * :file:`iplib.py`. Move to :file:`IPython.core`.