##// END OF EJS Templates
ultraTB.py => core/ultratb.py and imports updated.
Brian Granger -
r2048:d5d637e4
parent child
Show More
@@ -13,7 +13,7 import exceptions
13 import os
13 import os
14 from pprint import pprint
14 from pprint import pprint
15
15
16 from IPython import ultraTB
16 from IPython.core import ultratb
17 from IPython.utils.ipstruct import Struct
17 from IPython.utils.ipstruct import Struct
18 from IPython.utils.genutils import *
18 from IPython.utils.genutils import *
19
19
@@ -68,7 +68,7 class ConfigLoader:
68 # avoid including the same file more than once
68 # avoid including the same file more than once
69 if fname in self.included:
69 if fname in self.included:
70 return data
70 return data
71 Xinfo = ultraTB.AutoFormattedTB(color_scheme='NoColor')
71 Xinfo = ultratb.AutoFormattedTB(color_scheme='NoColor')
72 if convert==None and recurse_key : convert = {qwflat:recurse_key}
72 if convert==None and recurse_key : convert = {qwflat:recurse_key}
73 # for production, change warn to 0:
73 # for production, change warn to 0:
74 data.merge(read_dict(fname,convert,fs=self.field_sep,strip=1,
74 data.merge(read_dict(fname,convert,fs=self.field_sep,strip=1,
@@ -632,7 +632,7 class IPCompleter(Completer):
632 except IndexError:
632 except IndexError:
633 return None
633 return None
634 except:
634 except:
635 #from IPython.ultraTB import AutoFormattedTB; # dbg
635 #from IPython.core.ultratb import AutoFormattedTB; # dbg
636 #tb=AutoFormattedTB('Verbose');tb() #dbg
636 #tb=AutoFormattedTB('Verbose');tb() #dbg
637
637
638 # If completion fails, don't annoy the user.
638 # If completion fails, don't annoy the user.
@@ -25,7 +25,7 from pprint import pformat
25
25
26 # Our own
26 # Our own
27 from IPython.core import release
27 from IPython.core import release
28 from IPython import ultraTB
28 from IPython.core import ultratb
29 from IPython.external.Itpl import itpl
29 from IPython.external.Itpl import itpl
30
30
31 from IPython.utils.genutils import *
31 from IPython.utils.genutils import *
@@ -133,7 +133,7 $self.bug_tracker
133 # write the report filename into the instance dict so it can get
133 # write the report filename into the instance dict so it can get
134 # properly expanded out in the user message template
134 # properly expanded out in the user message template
135 self.crash_report_fname = report_name
135 self.crash_report_fname = report_name
136 TBhandler = ultraTB.VerboseTB(color_scheme=color_scheme,
136 TBhandler = ultratb.VerboseTB(color_scheme=color_scheme,
137 long_header=1)
137 long_header=1)
138 traceback = TBhandler.text(etype,evalue,etb,context=31)
138 traceback = TBhandler.text(etype,evalue,etb,context=31)
139
139
@@ -45,7 +45,7 import tempfile
45
45
46 # IPython's own modules
46 # IPython's own modules
47 #import IPython
47 #import IPython
48 from IPython import ultraTB
48 from IPython.core import ultratb
49 from IPython.utils import PyColorize
49 from IPython.utils import PyColorize
50 from IPython.core import debugger, oinspect
50 from IPython.core import debugger, oinspect
51 from IPython.Extensions import pickleshare
51 from IPython.Extensions import pickleshare
@@ -57,7 +57,7 from IPython.core.prompts import CachedOutput
57 from IPython.utils.ipstruct import Struct
57 from IPython.utils.ipstruct import Struct
58 from IPython.lib.backgroundjobs import BackgroundJobManager
58 from IPython.lib.backgroundjobs import BackgroundJobManager
59 from IPython.utils.genutils import *
59 from IPython.utils.genutils import *
60 from IPython.strdispatch import StrDispatch
60 from IPython.utils.strdispatch import StrDispatch
61 from IPython.core import ipapi
61 from IPython.core import ipapi
62 import IPython.core.history
62 import IPython.core.history
63 import IPython.core.prefilter as prefilter
63 import IPython.core.prefilter as prefilter
@@ -340,16 +340,16 class InputList(list):
340 def __getslice__(self,i,j):
340 def __getslice__(self,i,j):
341 return ''.join(list.__getslice__(self,i,j))
341 return ''.join(list.__getslice__(self,i,j))
342
342
343 class SyntaxTB(ultraTB.ListTB):
343 class SyntaxTB(ultratb.ListTB):
344 """Extension which holds some state: the last exception value"""
344 """Extension which holds some state: the last exception value"""
345
345
346 def __init__(self,color_scheme = 'NoColor'):
346 def __init__(self,color_scheme = 'NoColor'):
347 ultraTB.ListTB.__init__(self,color_scheme)
347 ultratb.ListTB.__init__(self,color_scheme)
348 self.last_syntax_error = None
348 self.last_syntax_error = None
349
349
350 def __call__(self, etype, value, elist):
350 def __call__(self, etype, value, elist):
351 self.last_syntax_error = value
351 self.last_syntax_error = value
352 ultraTB.ListTB.__call__(self,etype,value,elist)
352 ultratb.ListTB.__call__(self,etype,value,elist)
353
353
354 def clear_err_state(self):
354 def clear_err_state(self):
355 """Return the current error state and clear it"""
355 """Return the current error state and clear it"""
@@ -714,7 +714,7 class InteractiveShell(object,Magic):
714 # The interactive one is initialized with an offset, meaning we always
714 # The interactive one is initialized with an offset, meaning we always
715 # want to remove the topmost item in the traceback, which is our own
715 # want to remove the topmost item in the traceback, which is our own
716 # internal code. Valid modes: ['Plain','Context','Verbose']
716 # internal code. Valid modes: ['Plain','Context','Verbose']
717 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
717 self.InteractiveTB = ultratb.AutoFormattedTB(mode = 'Plain',
718 color_scheme='NoColor',
718 color_scheme='NoColor',
719 tb_offset = 1)
719 tb_offset = 1)
720
720
@@ -725,7 +725,7 class InteractiveShell(object,Magic):
725 # thread (such as in GUI code) propagate directly to sys.excepthook,
725 # thread (such as in GUI code) propagate directly to sys.excepthook,
726 # and there's no point in printing crash dumps for every user exception.
726 # and there's no point in printing crash dumps for every user exception.
727 if self.isthreaded:
727 if self.isthreaded:
728 ipCrashHandler = ultraTB.FormattedTB()
728 ipCrashHandler = ultratb.FormattedTB()
729 else:
729 else:
730 from IPython.core import crashhandler
730 from IPython.core import crashhandler
731 ipCrashHandler = crashhandler.IPythonCrashHandler(self)
731 ipCrashHandler = crashhandler.IPythonCrashHandler(self)
@@ -106,8 +106,8 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
106
106
107 if DEVDEBUG:
107 if DEVDEBUG:
108 # For developer debugging only (global flag)
108 # For developer debugging only (global flag)
109 from IPython import ultraTB
109 from IPython.core import ultratb
110 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
110 sys.excepthook = ultratb.VerboseTB(call_pdb=1)
111
111
112 IP.BANNER_PARTS = ['Python %s\n'
112 IP.BANNER_PARTS = ['Python %s\n'
113 'Type "copyright", "credits" or "license" '
113 'Type "copyright", "credits" or "license" '
@@ -34,7 +34,7 except ImportError:
34
34
35 # IPython imports
35 # IPython imports
36 import IPython
36 import IPython
37 from IPython import ultraTB
37 from IPython.core import ultratb
38 from IPython.core import ipapi
38 from IPython.core import ipapi
39 from IPython.core.magic import Magic
39 from IPython.core.magic import Magic
40 from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no
40 from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no
@@ -178,7 +178,7 class IPShellEmbed:
178 sys.displayhook = self.sys_displayhook_ori
178 sys.displayhook = self.sys_displayhook_ori
179 # don't use the ipython crash handler so that user exceptions aren't
179 # don't use the ipython crash handler so that user exceptions aren't
180 # trapped
180 # trapped
181 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
181 sys.excepthook = ultratb.FormattedTB(color_scheme = self.IP.rc.colors,
182 mode = self.IP.rc.xmode,
182 mode = self.IP.rc.xmode,
183 call_pdb = self.IP.rc.pdb)
183 call_pdb = self.IP.rc.pdb)
184 self.restore_system_completer()
184 self.restore_system_completer()
@@ -63,3 +63,6 def test_import_shell():
63
63
64 def test_import_shellglobals():
64 def test_import_shellglobals():
65 from IPython.core import shellglobals
65 from IPython.core import shellglobals
66
67 def test_import_ultratb():
68 from IPython.core import ultratb
@@ -1,6 +1,6
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 ultraTB.py -- Spice up your tracebacks!
3 ultratb.py -- Spice up your tracebacks!
4
4
5 * ColorTB
5 * ColorTB
6 I've always found it a bit hard to visually parse tracebacks in Python. The
6 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
9 text editor.
9 text editor.
10
10
11 Installation instructions for ColorTB:
11 Installation instructions for ColorTB:
12 import sys,ultraTB
12 import sys,ultratb
13 sys.excepthook = ultraTB.ColorTB()
13 sys.excepthook = ultratb.ColorTB()
14
14
15 * VerboseTB
15 * VerboseTB
16 I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds
16 I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds
@@ -37,8 +37,8 Note:
37
37
38
38
39 Installation instructions for ColorTB:
39 Installation instructions for ColorTB:
40 import sys,ultraTB
40 import sys,ultratb
41 sys.excepthook = ultraTB.VerboseTB()
41 sys.excepthook = ultratb.VerboseTB()
42
42
43 Note: Much of the code in this module was lifted verbatim from the standard
43 Note: Much of the code in this module was lifted verbatim from the standard
44 library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'.
44 library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'.
@@ -103,7 +103,7 INDENT_SIZE = 8
103 # Default color scheme. This is used, for example, by the traceback
103 # Default color scheme. This is used, for example, by the traceback
104 # formatter. When running in an actual IPython instance, the user's rc.colors
104 # formatter. When running in an actual IPython instance, the user's rc.colors
105 # value is used, but havinga module global makes this functionality available
105 # value is used, but havinga module global makes this functionality available
106 # to users of ultraTB who are NOT running inside ipython.
106 # to users of ultratb who are NOT running inside ipython.
107 DEFAULT_SCHEME = 'NoColor'
107 DEFAULT_SCHEME = 'NoColor'
108
108
109 #---------------------------------------------------------------------------
109 #---------------------------------------------------------------------------
@@ -30,7 +30,7 separate implementation).
30 import sys
30 import sys
31 import threading
31 import threading
32
32
33 from IPython.ultraTB import AutoFormattedTB
33 from IPython.core.ultratb import AutoFormattedTB
34 from IPython.utils.genutils import warn,error
34 from IPython.utils.genutils import warn,error
35
35
36 class BackgroundJobManager:
36 class BackgroundJobManager:
@@ -207,7 +207,7 def make_runners():
207 'outputtrap.py', 'platutils.py', 'prefilter.py', 'prompts.py',
207 'outputtrap.py', 'platutils.py', 'prefilter.py', 'prompts.py',
208 'PyColorize.py', 'release.py', 'rlineimpl.py', 'shadowns.py',
208 'PyColorize.py', 'release.py', 'rlineimpl.py', 'shadowns.py',
209 'shellglobals.py', 'strdispatch.py', 'twshell.py',
209 'shellglobals.py', 'strdispatch.py', 'twshell.py',
210 'ultraTB.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py',
210 'ultratb.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py',
211 # See note above for why this is skipped
211 # See note above for why this is skipped
212 # 'shell.py',
212 # 'shell.py',
213 'winconsole.py']
213 'winconsole.py']
@@ -43,7 +43,7 iplib: plugin
43 $(NOSE) IPython.core.iplib
43 $(NOSE) IPython.core.iplib
44
44
45 strd: plugin
45 strd: plugin
46 $(NOSE) IPython.strdispatch
46 $(NOSE) IPython.core.strdispatch
47
47
48 engine: plugin
48 engine: plugin
49 $(NOSE) IPython.kernel
49 $(NOSE) IPython.kernel
1 NO CONTENT: file renamed from IPython/strdispatch.py to IPython/utils/strdispatch.py
NO CONTENT: file renamed from IPython/strdispatch.py to IPython/utils/strdispatch.py
@@ -23,4 +23,7 def test_import_PyColorize():
23 from IPython.utils import PyColorize
23 from IPython.utils import PyColorize
24
24
25 def test_import_rlineimpl():
25 def test_import_rlineimpl():
26 from IPython.utils import rlineimpl No newline at end of file
26 from IPython.utils import rlineimpl
27
28 def test_import_strdispatch():
29 from IPython.utils import strdispatch No newline at end of file
@@ -135,18 +135,37 Where things will be moved
135
135
136 * :file:`ipapi.py`. Move to :file:`IPython.core`.
136 * :file:`ipapi.py`. Move to :file:`IPython.core`.
137
137
138 * :file:`iplib.py`. Move to :file:`IPython.core`.
139
140 * :file:`ipmaker.py`: Move to :file:`IPython.core`.
138
141
142 * :file:`ipstruct.py`. Move to :file:`IPython.python`.
143
144 * :file:`irunner.py`. Move to :file:`IPython.scripts`. ???
139
145
140 * :file:`Itpl.py`. Remove. Version already in :file:`IPython.external`.
146 * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in
147 :file:`IPython.external`.
141
148
142 * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`.
149 * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`.
143
150
151 * :file:`macro.py`. Move to :file:`IPython.core`.
152
144 * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`.
153 * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`.
145
154
146 * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`.
155 * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`.
147
156
148 * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`.
157 * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`.
149
158
159 * :file:`platutils.py`. Move to :file:`IPython.python`.
160
161 * :file:`platutils_dummy.py`. Move to :file:`IPython.python`.
162
163 * :file:`platutils_posix.py`. Move to :file:`IPython.python`.
164
165 * :file:`platutils_win32.py`. Move to :file:`IPython.python`.
166
167 * :file:`prefilter.py`: Move to :file:`IPython.core`.
168
150 * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or
169 * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or
151 :file:`IPython/frontend/prompts.py`.
170 :file:`IPython/frontend/prompts.py`.
152
171
@@ -156,9 +175,24 Where things will be moved
156
175
157 * :file:`Release.py`. Move to ??? or remove?
176 * :file:`Release.py`. Move to ??? or remove?
158
177
178 * :file:`rlineimpl.py`. Move to :file:`IPython.core`.
179
180 * :file:`shadowns.py`. Move to :file:`IPython.core`.
181
159 * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or
182 * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or
160 :file:`IPython/frontend/shell.py`.
183 :file:`IPython/frontend/shell.py`.
161
184
185 * :file:`shellglobals.py`. Move to :file:`IPython.core`.
186
187 * :file:`strdispatch.py`. Move to :file:`IPython.python`.
188
189 * :file:`testing`. Good where it is.
190
191 * :file:`tests`. Good where it is.
192
193 * :file:`tools`. Things in here need to be looked at and moved elsewhere like
194 :file:`IPython.python`.
195
162 * :file:`UserConfig`. Move to a subdirectory of :file:`IPython.config`.
196 * :file:`UserConfig`. Move to a subdirectory of :file:`IPython.config`.
163
197
164
198
@@ -181,44 +215,25 Where things will be moved
181
215
182
216
183
217
184 * :file:`iplib.py`. Move to :file:`IPython.core`.
185
218
186 * :file:`ipmaker.py`: Move to :file:`IPython.core`.
187
219
188 * :file:`ipstruct.py`. Move to :file:`IPython.python`.
189
220
190 * :file:`irunner.py`. Move to :file:`IPython.scripts`.
191
221
192 * :file:`kernel`. Good where it is.
222 * :file:`kernel`. Good where it is.
193
223
194 * :file:`macro.py`. Move to :file:`IPython.core`.
195
196
224
197
225
198 * :file:`platutils.py`. Move to :file:`IPython.python`.
199
226
200 * :file:`platutils_dummy.py`. Move to :file:`IPython.python`.
201
227
202 * :file:`platutils_posix.py`. Move to :file:`IPython.python`.
203
228
204 * :file:`platutils_win32.py`. Move to :file:`IPython.python`.
205
229
206 * :file:`prefilter.py`: Move to :file:`IPython.core`.
207
230
208 * :file:`rlineimpl.py`. Move to :file:`IPython.core`.
209
231
210 * :file:`shadowns.py`. Move to :file:`IPython.core`.
211
232
212 * :file:`shellglobals.py`. Move to :file:`IPython.core`.
213
233
214 * :file:`strdispatch.py`. Move to :file:`IPython.python`.
215
234
216 * :file:`testing`. Good where it is.
217
235
218 * :file:`tests`. Good where it is.
219
236
220 * :file:`tools`. Things in here need to be looked at and moved elsewhere like
221 :file:`IPython.python`.
222
237
223 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
238 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
224
239
General Comments 0
You need to be logged in to leave comments. Login now