##// END OF EJS Templates
Update IPython/core/formatters.py to use new traitlets API....
Matthias Bussonnier -
Show More
@@ -11,7 +11,6 b' Inheritance diagram:'
11 11 # Distributed under the terms of the Modified BSD License.
12 12
13 13 import abc
14 import inspect
15 14 import json
16 15 import sys
17 16 import traceback
@@ -36,7 +35,7 b' from IPython.utils.py3compat import ('
36 35 class DisplayFormatter(Configurable):
37 36
38 37 # When set to true only the default plain text formatter will be used.
39 plain_text_only = Bool(False, config=True)
38 plain_text_only = Bool(False).tag(config=True)
40 39 def _plain_text_only_changed(self, name, old, new):
41 40 warnings.warn("""DisplayFormatter.plain_text_only is deprecated.
42 41
@@ -50,7 +49,7 b' class DisplayFormatter(Configurable):'
50 49 else:
51 50 self.active_types = self.format_types
52 51
53 active_types = List(Unicode(), config=True,
52 active_types = List(Unicode()).tag(config=True,
54 53 help="""List of currently active mime-types to display.
55 54 You can use this to set a white-list for formats to display.
56 55
@@ -288,21 +287,21 b' class BaseFormatter(Configurable):'
288 287 format_type = Unicode('text/plain')
289 288 _return_type = string_types
290 289
291 enabled = Bool(True, config=True)
290 enabled = Bool(True).tag(config=True)
292 291
293 292 print_method = ObjectName('__repr__')
294 293
295 294 # The singleton printers.
296 295 # Maps the IDs of the builtin singleton objects to the format functions.
297 singleton_printers = Dict(config=True)
296 singleton_printers = Dict().tag(config=True)
298 297
299 298 # The type-specific printers.
300 299 # Map type objects to the format functions.
301 type_printers = Dict(config=True)
300 type_printers = Dict().tag(config=True)
302 301
303 302 # The deferred-import type-specific printers.
304 303 # Map (modulename, classname) pairs to the format functions.
305 deferred_printers = Dict(config=True)
304 deferred_printers = Dict().tag(config=True)
306 305
307 306 @catch_format_error
308 307 def __call__(self, obj):
@@ -569,9 +568,9 b' class PlainTextFormatter(BaseFormatter):'
569 568
570 569 # This subclass ignores this attribute as it always need to return
571 570 # something.
572 enabled = Bool(True, config=False)
571 enabled = Bool(True).tag(config=False)
573 572
574 max_seq_length = Integer(pretty.MAX_SEQ_LENGTH, config=True,
573 max_seq_length = Integer(pretty.MAX_SEQ_LENGTH).tag(config=True,
575 574 help="""Truncate large collections (lists, dicts, tuples, sets) to this size.
576 575
577 576 Set to 0 to disable truncation.
@@ -582,21 +581,21 b' class PlainTextFormatter(BaseFormatter):'
582 581 print_method = ObjectName('_repr_pretty_')
583 582
584 583 # Whether to pretty-print or not.
585 pprint = Bool(True, config=True)
584 pprint = Bool(True).tag(config=True)
586 585
587 586 # Whether to be verbose or not.
588 verbose = Bool(False, config=True)
587 verbose = Bool(False).tag(config=True)
589 588
590 589 # The maximum width.
591 max_width = Integer(79, config=True)
590 max_width = Integer(79).tag(config=True)
592 591
593 592 # The newline character.
594 newline = Unicode('\n', config=True)
593 newline = Unicode('\n').tag(config=True)
595 594
596 595 # format-string for pprinting floats
597 596 float_format = Unicode('%r')
598 597 # setter for float precision, either int or direct format-string
599 float_precision = CUnicode('', config=True)
598 float_precision = CUnicode('').tag(config=True)
600 599
601 600 def _float_precision_changed(self, name, old, new):
602 601 """float_precision changed, set float_format accordingly.
General Comments 0
You need to be logged in to leave comments. Login now