Show More
@@ -580,7 +580,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
580 | 580 | separate_out = SeparateUnicode('').tag(config=True) |
|
581 | 581 | separate_out2 = SeparateUnicode('').tag(config=True) |
|
582 | 582 | wildcards_case_sensitive = Bool(True).tag(config=True) |
|
583 | xmode = CaselessStrEnum(('Context','Plain', 'Verbose'), | |
|
583 | xmode = CaselessStrEnum(('Context', 'Plain', 'Verbose', 'Minimal'), | |
|
584 | 584 | default_value='Context', |
|
585 | 585 | help="Switch modes for the IPython exception handlers." |
|
586 | 586 | ).tag(config=True) |
@@ -1788,7 +1788,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1788 | 1788 | |
|
1789 | 1789 | # The interactive one is initialized with an offset, meaning we always |
|
1790 | 1790 | # want to remove the topmost item in the traceback, which is our own |
|
1791 | # internal code. Valid modes: ['Plain','Context','Verbose'] | |
|
1791 | # internal code. Valid modes: ['Plain','Context','Verbose','Minimal'] | |
|
1792 | 1792 | self.InteractiveTB = ultratb.AutoFormattedTB(mode = 'Plain', |
|
1793 | 1793 | color_scheme='NoColor', |
|
1794 | 1794 | tb_offset = 1, |
@@ -363,7 +363,7 b' Currently the magic system has the following functions:""",' | |||
|
363 | 363 | def xmode(self, parameter_s=''): |
|
364 | 364 | """Switch modes for the exception handlers. |
|
365 | 365 | |
|
366 |
Valid modes: Plain, Context |
|
|
366 | Valid modes: Plain, Context, Verbose, and Minimal. | |
|
367 | 367 | |
|
368 | 368 | If called without arguments, acts as a toggle.""" |
|
369 | 369 |
@@ -111,6 +111,9 b' class NonAsciiTest(unittest.TestCase):' | |||
|
111 | 111 | with tt.AssertPrints(expected): |
|
112 | 112 | ip.run_cell(cell) |
|
113 | 113 | |
|
114 | ip.run_cell("%xmode minimal") | |
|
115 | with tt.AssertPrints(u"Exception: é"): | |
|
116 | ip.run_cell(cell) | |
|
114 | 117 | |
|
115 | 118 | class NestedGenExprTestCase(unittest.TestCase): |
|
116 | 119 | """ |
@@ -1251,7 +1251,7 b' class FormattedTB(VerboseTB, ListTB):' | |||
|
1251 | 1251 | parent=None, config=None): |
|
1252 | 1252 | |
|
1253 | 1253 | # NEVER change the order of this list. Put new modes at the end: |
|
1254 | self.valid_modes = ['Plain', 'Context', 'Verbose'] | |
|
1254 | self.valid_modes = ['Plain', 'Context', 'Verbose', 'Minimal'] | |
|
1255 | 1255 | self.verbose_modes = self.valid_modes[1:3] |
|
1256 | 1256 | |
|
1257 | 1257 | VerboseTB.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb, |
@@ -1262,7 +1262,8 b' class FormattedTB(VerboseTB, ListTB):' | |||
|
1262 | 1262 | |
|
1263 | 1263 | # Different types of tracebacks are joined with different separators to |
|
1264 | 1264 | # form a single string. They are taken from this dict |
|
1265 |
self._join_chars = dict(Plain='', Context='\n', Verbose='\n' |
|
|
1265 | self._join_chars = dict(Plain='', Context='\n', Verbose='\n', | |
|
1266 | Minimal='') | |
|
1266 | 1267 | # set_mode also sets the tb_join_char attribute |
|
1267 | 1268 | self.set_mode(mode) |
|
1268 | 1269 | |
@@ -1280,6 +1281,8 b' class FormattedTB(VerboseTB, ListTB):' | |||
|
1280 | 1281 | return VerboseTB.structured_traceback( |
|
1281 | 1282 | self, etype, value, tb, tb_offset, number_of_lines_of_context |
|
1282 | 1283 | ) |
|
1284 | elif mode == 'Minimal': | |
|
1285 | return ListTB.get_exception_only(self, etype, value) | |
|
1283 | 1286 | else: |
|
1284 | 1287 | # We must check the source cache because otherwise we can print |
|
1285 | 1288 | # out-of-date source code. |
@@ -1324,6 +1327,9 b' class FormattedTB(VerboseTB, ListTB):' | |||
|
1324 | 1327 | def verbose(self): |
|
1325 | 1328 | self.set_mode(self.valid_modes[2]) |
|
1326 | 1329 | |
|
1330 | def minimal(self): | |
|
1331 | self.set_mode(self.valid_modes[3]) | |
|
1332 | ||
|
1327 | 1333 | |
|
1328 | 1334 | #---------------------------------------------------------------------------- |
|
1329 | 1335 | class AutoFormattedTB(FormattedTB): |
General Comments 0
You need to be logged in to leave comments.
Login now