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