Show More
@@ -218,8 +218,8 class FormatterWarning(UserWarning): | |||||
218 | """Warning class for errors in formatters""" |
|
218 | """Warning class for errors in formatters""" | |
219 |
|
219 | |||
220 | @decorator |
|
220 | @decorator | |
221 |
def |
|
221 | def catch_format_error(method, self, *args, **kwargs): | |
222 |
""" |
|
222 | """show traceback on failed format call""" | |
223 | try: |
|
223 | try: | |
224 | r = method(self, *args, **kwargs) |
|
224 | r = method(self, *args, **kwargs) | |
225 | except NotImplementedError: |
|
225 | except NotImplementedError: | |
@@ -322,7 +322,7 class BaseFormatter(Configurable): | |||||
322 | # Map (modulename, classname) pairs to the format functions. |
|
322 | # Map (modulename, classname) pairs to the format functions. | |
323 | deferred_printers = Dict(config=True) |
|
323 | deferred_printers = Dict(config=True) | |
324 |
|
324 | |||
325 |
@ |
|
325 | @catch_format_error | |
326 | def __call__(self, obj): |
|
326 | def __call__(self, obj): | |
327 | """Compute the format for an object.""" |
|
327 | """Compute the format for an object.""" | |
328 | if self.enabled: |
|
328 | if self.enabled: | |
@@ -675,7 +675,7 class PlainTextFormatter(BaseFormatter): | |||||
675 |
|
675 | |||
676 | #### FormatterABC interface #### |
|
676 | #### FormatterABC interface #### | |
677 |
|
677 | |||
678 |
@ |
|
678 | @catch_format_error | |
679 | def __call__(self, obj): |
|
679 | def __call__(self, obj): | |
680 | """Compute the pretty representation of the object.""" |
|
680 | """Compute the pretty representation of the object.""" | |
681 | if not self.pprint: |
|
681 | if not self.pprint: | |
@@ -887,7 +887,7 class IPythonDisplayFormatter(BaseFormatter): | |||||
887 | _return_type = (type(None), bool) |
|
887 | _return_type = (type(None), bool) | |
888 |
|
888 | |||
889 |
|
889 | |||
890 |
@ |
|
890 | @catch_format_error | |
891 | def __call__(self, obj): |
|
891 | def __call__(self, obj): | |
892 | """Compute the format for an object.""" |
|
892 | """Compute the format for an object.""" | |
893 | if self.enabled: |
|
893 | if self.enabled: |
General Comments 0
You need to be logged in to leave comments.
Login now