diff --git a/IPython/config/configloader.py b/IPython/config/configloader.py index b6c8bf0..c8aeb37 100644 --- a/IPython/config/configloader.py +++ b/IPython/config/configloader.py @@ -13,7 +13,7 @@ import exceptions import os from pprint import pprint -from IPython import ultraTB +from IPython.core import ultratb from IPython.utils.ipstruct import Struct from IPython.utils.genutils import * @@ -68,7 +68,7 @@ class ConfigLoader: # avoid including the same file more than once if fname in self.included: return data - Xinfo = ultraTB.AutoFormattedTB(color_scheme='NoColor') + Xinfo = ultratb.AutoFormattedTB(color_scheme='NoColor') if convert==None and recurse_key : convert = {qwflat:recurse_key} # for production, change warn to 0: data.merge(read_dict(fname,convert,fs=self.field_sep,strip=1, diff --git a/IPython/core/completer.py b/IPython/core/completer.py index 15f10f9..fcf8262 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -632,7 +632,7 @@ class IPCompleter(Completer): except IndexError: return None except: - #from IPython.ultraTB import AutoFormattedTB; # dbg + #from IPython.core.ultratb import AutoFormattedTB; # dbg #tb=AutoFormattedTB('Verbose');tb() #dbg # If completion fails, don't annoy the user. diff --git a/IPython/core/crashhandler.py b/IPython/core/crashhandler.py index 0cec89e..fa588f0 100644 --- a/IPython/core/crashhandler.py +++ b/IPython/core/crashhandler.py @@ -25,7 +25,7 @@ from pprint import pformat # Our own from IPython.core import release -from IPython import ultraTB +from IPython.core import ultratb from IPython.external.Itpl import itpl from IPython.utils.genutils import * @@ -133,7 +133,7 @@ $self.bug_tracker # write the report filename into the instance dict so it can get # properly expanded out in the user message template self.crash_report_fname = report_name - TBhandler = ultraTB.VerboseTB(color_scheme=color_scheme, + TBhandler = ultratb.VerboseTB(color_scheme=color_scheme, long_header=1) traceback = TBhandler.text(etype,evalue,etb,context=31) diff --git a/IPython/core/iplib.py b/IPython/core/iplib.py index 9754e67..81fc0a8 100644 --- a/IPython/core/iplib.py +++ b/IPython/core/iplib.py @@ -45,7 +45,7 @@ import tempfile # IPython's own modules #import IPython -from IPython import ultraTB +from IPython.core import ultratb from IPython.utils import PyColorize from IPython.core import debugger, oinspect from IPython.Extensions import pickleshare @@ -57,7 +57,7 @@ from IPython.core.prompts import CachedOutput from IPython.utils.ipstruct import Struct from IPython.lib.backgroundjobs import BackgroundJobManager from IPython.utils.genutils import * -from IPython.strdispatch import StrDispatch +from IPython.utils.strdispatch import StrDispatch from IPython.core import ipapi import IPython.core.history import IPython.core.prefilter as prefilter @@ -340,16 +340,16 @@ class InputList(list): def __getslice__(self,i,j): return ''.join(list.__getslice__(self,i,j)) -class SyntaxTB(ultraTB.ListTB): +class SyntaxTB(ultratb.ListTB): """Extension which holds some state: the last exception value""" def __init__(self,color_scheme = 'NoColor'): - ultraTB.ListTB.__init__(self,color_scheme) + ultratb.ListTB.__init__(self,color_scheme) self.last_syntax_error = None def __call__(self, etype, value, elist): self.last_syntax_error = value - ultraTB.ListTB.__call__(self,etype,value,elist) + ultratb.ListTB.__call__(self,etype,value,elist) def clear_err_state(self): """Return the current error state and clear it""" @@ -714,7 +714,7 @@ class InteractiveShell(object,Magic): # The interactive one is initialized with an offset, meaning we always # want to remove the topmost item in the traceback, which is our own # internal code. Valid modes: ['Plain','Context','Verbose'] - self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain', + self.InteractiveTB = ultratb.AutoFormattedTB(mode = 'Plain', color_scheme='NoColor', tb_offset = 1) @@ -725,7 +725,7 @@ class InteractiveShell(object,Magic): # thread (such as in GUI code) propagate directly to sys.excepthook, # and there's no point in printing crash dumps for every user exception. if self.isthreaded: - ipCrashHandler = ultraTB.FormattedTB() + ipCrashHandler = ultratb.FormattedTB() else: from IPython.core import crashhandler ipCrashHandler = crashhandler.IPythonCrashHandler(self) diff --git a/IPython/core/ipmaker.py b/IPython/core/ipmaker.py index ffbc233..059820a 100644 --- a/IPython/core/ipmaker.py +++ b/IPython/core/ipmaker.py @@ -106,8 +106,8 @@ def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1, if DEVDEBUG: # For developer debugging only (global flag) - from IPython import ultraTB - sys.excepthook = ultraTB.VerboseTB(call_pdb=1) + from IPython.core import ultratb + sys.excepthook = ultratb.VerboseTB(call_pdb=1) IP.BANNER_PARTS = ['Python %s\n' 'Type "copyright", "credits" or "license" ' diff --git a/IPython/core/shell.py b/IPython/core/shell.py index 6e94ec6..340a83c 100644 --- a/IPython/core/shell.py +++ b/IPython/core/shell.py @@ -34,7 +34,7 @@ except ImportError: # IPython imports import IPython -from IPython import ultraTB +from IPython.core import ultratb from IPython.core import ipapi from IPython.core.magic import Magic from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no @@ -178,7 +178,7 @@ class IPShellEmbed: sys.displayhook = self.sys_displayhook_ori # don't use the ipython crash handler so that user exceptions aren't # trapped - sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors, + sys.excepthook = ultratb.FormattedTB(color_scheme = self.IP.rc.colors, mode = self.IP.rc.xmode, call_pdb = self.IP.rc.pdb) self.restore_system_completer() diff --git a/IPython/core/tests/test_imports.py b/IPython/core/tests/test_imports.py index 14fd954..2cb3a75 100644 --- a/IPython/core/tests/test_imports.py +++ b/IPython/core/tests/test_imports.py @@ -63,3 +63,6 @@ def test_import_shell(): def test_import_shellglobals(): from IPython.core import shellglobals + +def test_import_ultratb(): + from IPython.core import ultratb diff --git a/IPython/ultraTB.py b/IPython/core/ultratb.py similarity index 98% rename from IPython/ultraTB.py rename to IPython/core/ultratb.py index 6184f71..48150b7 100644 --- a/IPython/ultraTB.py +++ b/IPython/core/ultratb.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -ultraTB.py -- Spice up your tracebacks! +ultratb.py -- Spice up your tracebacks! * ColorTB I've always found it a bit hard to visually parse tracebacks in Python. The @@ -9,8 +9,8 @@ traceback in a manner similar to what you would expect from a syntax-highlightin text editor. Installation instructions for ColorTB: - import sys,ultraTB - sys.excepthook = ultraTB.ColorTB() + import sys,ultratb + sys.excepthook = ultratb.ColorTB() * VerboseTB I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds @@ -37,8 +37,8 @@ Note: Installation instructions for ColorTB: - import sys,ultraTB - sys.excepthook = ultraTB.VerboseTB() + import sys,ultratb + sys.excepthook = ultratb.VerboseTB() Note: Much of the code in this module was lifted verbatim from the standard library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'. @@ -103,7 +103,7 @@ INDENT_SIZE = 8 # Default color scheme. This is used, for example, by the traceback # formatter. When running in an actual IPython instance, the user's rc.colors # value is used, but havinga module global makes this functionality available -# to users of ultraTB who are NOT running inside ipython. +# to users of ultratb who are NOT running inside ipython. DEFAULT_SCHEME = 'NoColor' #--------------------------------------------------------------------------- diff --git a/IPython/lib/backgroundjobs.py b/IPython/lib/backgroundjobs.py index ab6b845..6f49522 100644 --- a/IPython/lib/backgroundjobs.py +++ b/IPython/lib/backgroundjobs.py @@ -30,7 +30,7 @@ separate implementation). import sys import threading -from IPython.ultraTB import AutoFormattedTB +from IPython.core.ultratb import AutoFormattedTB from IPython.utils.genutils import warn,error class BackgroundJobManager: diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 5bf5793..420f03a 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -207,7 +207,7 @@ def make_runners(): 'outputtrap.py', 'platutils.py', 'prefilter.py', 'prompts.py', 'PyColorize.py', 'release.py', 'rlineimpl.py', 'shadowns.py', 'shellglobals.py', 'strdispatch.py', 'twshell.py', - 'ultraTB.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py', + 'ultratb.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py', # See note above for why this is skipped # 'shell.py', 'winconsole.py'] diff --git a/IPython/testing/plugin/Makefile b/IPython/testing/plugin/Makefile index 0b66c18..db82075 100644 --- a/IPython/testing/plugin/Makefile +++ b/IPython/testing/plugin/Makefile @@ -43,7 +43,7 @@ iplib: plugin $(NOSE) IPython.core.iplib strd: plugin - $(NOSE) IPython.strdispatch + $(NOSE) IPython.core.strdispatch engine: plugin $(NOSE) IPython.kernel diff --git a/IPython/strdispatch.py b/IPython/utils/strdispatch.py similarity index 100% rename from IPython/strdispatch.py rename to IPython/utils/strdispatch.py diff --git a/IPython/utils/tests/test_imports.py b/IPython/utils/tests/test_imports.py index 12fcf52..42b2ed2 100644 --- a/IPython/utils/tests/test_imports.py +++ b/IPython/utils/tests/test_imports.py @@ -23,4 +23,7 @@ def test_import_PyColorize(): from IPython.utils import PyColorize def test_import_rlineimpl(): - from IPython.utils import rlineimpl \ No newline at end of file + from IPython.utils import rlineimpl + +def test_import_strdispatch(): + from IPython.utils import strdispatch \ No newline at end of file diff --git a/docs/source/development/reorg.txt b/docs/source/development/reorg.txt index 81d7df7..ac282c8 100644 --- a/docs/source/development/reorg.txt +++ b/docs/source/development/reorg.txt @@ -135,18 +135,37 @@ Where things will be moved * :file:`ipapi.py`. Move to :file:`IPython.core`. +* :file:`iplib.py`. Move to :file:`IPython.core`. + +* :file:`ipmaker.py`: Move to :file:`IPython.core`. +* :file:`ipstruct.py`. Move to :file:`IPython.python`. + +* :file:`irunner.py`. Move to :file:`IPython.scripts`. ??? -* :file:`Itpl.py`. Remove. Version already in :file:`IPython.external`. +* :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in + :file:`IPython.external`. * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`. +* :file:`macro.py`. Move to :file:`IPython.core`. + * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`. * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`. * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`. +* :file:`platutils.py`. Move to :file:`IPython.python`. + +* :file:`platutils_dummy.py`. Move to :file:`IPython.python`. + +* :file:`platutils_posix.py`. Move to :file:`IPython.python`. + +* :file:`platutils_win32.py`. Move to :file:`IPython.python`. + +* :file:`prefilter.py`: Move to :file:`IPython.core`. + * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or :file:`IPython/frontend/prompts.py`. @@ -156,9 +175,24 @@ Where things will be moved * :file:`Release.py`. Move to ??? or remove? +* :file:`rlineimpl.py`. Move to :file:`IPython.core`. + +* :file:`shadowns.py`. Move to :file:`IPython.core`. + * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or :file:`IPython/frontend/shell.py`. +* :file:`shellglobals.py`. Move to :file:`IPython.core`. + +* :file:`strdispatch.py`. Move to :file:`IPython.python`. + +* :file:`testing`. Good where it is. + +* :file:`tests`. Good where it is. + +* :file:`tools`. Things in here need to be looked at and moved elsewhere like + :file:`IPython.python`. + * :file:`UserConfig`. Move to a subdirectory of :file:`IPython.config`. @@ -181,44 +215,25 @@ Where things will be moved -* :file:`iplib.py`. Move to :file:`IPython.core`. -* :file:`ipmaker.py`: Move to :file:`IPython.core`. -* :file:`ipstruct.py`. Move to :file:`IPython.python`. -* :file:`irunner.py`. Move to :file:`IPython.scripts`. * :file:`kernel`. Good where it is. -* :file:`macro.py`. Move to :file:`IPython.core`. - -* :file:`platutils.py`. Move to :file:`IPython.python`. -* :file:`platutils_dummy.py`. Move to :file:`IPython.python`. -* :file:`platutils_posix.py`. Move to :file:`IPython.python`. -* :file:`platutils_win32.py`. Move to :file:`IPython.python`. -* :file:`prefilter.py`: Move to :file:`IPython.core`. -* :file:`rlineimpl.py`. Move to :file:`IPython.core`. -* :file:`shadowns.py`. Move to :file:`IPython.core`. -* :file:`shellglobals.py`. Move to :file:`IPython.core`. -* :file:`strdispatch.py`. Move to :file:`IPython.python`. -* :file:`testing`. Good where it is. -* :file:`tests`. Good where it is. -* :file:`tools`. Things in here need to be looked at and moved elsewhere like - :file:`IPython.python`. * :file:`twshell.py`. Move to :file:`IPython.sandbox`.