Show More
@@ -122,8 +122,6 b' else:' | |||
|
122 | 122 | __all__ = ['pretty', 'pprint', 'PrettyPrinter', 'RepresentationPrinter', |
|
123 | 123 | 'for_type', 'for_type_by_name'] |
|
124 | 124 | |
|
125 | SEQ_LENGTH_LIMIT = 1000 | |
|
126 | ||
|
127 | 125 | _re_pattern_type = type(re.compile('')) |
|
128 | 126 | |
|
129 | 127 | def _failed_repr(obj, e): |
@@ -230,10 +228,11 b' class PrettyPrinter(_PrettyPrinterBase):' | |||
|
230 | 228 | callback method. |
|
231 | 229 | """ |
|
232 | 230 | |
|
233 | def __init__(self, output, max_width=79, newline='\n'): | |
|
231 | def __init__(self, output, max_width=79, newline='\n', max_seq_length=1000): | |
|
234 | 232 | self.output = output |
|
235 | 233 | self.max_width = max_width |
|
236 | 234 | self.newline = newline |
|
235 | self.max_seq_length = max_seq_length | |
|
237 | 236 | self.output_width = 0 |
|
238 | 237 | self.buffer_width = 0 |
|
239 | 238 | self.buffer = deque() |
@@ -606,13 +605,13 b' def _seq_pprinter_factory(start, end, basetype):' | |||
|
606 | 605 | return p.text(start + '...' + end) |
|
607 | 606 | step = len(start) |
|
608 | 607 | p.begin_group(step, start) |
|
609 |
for idx, x in _enumerate(obj, |
|
|
608 | for idx, x in _enumerate(obj, p.max_seq_length): | |
|
610 | 609 | if idx: |
|
611 | 610 | p.text(',') |
|
612 | 611 | p.breakable() |
|
613 | 612 | p.pretty(x) |
|
614 | 613 | |
|
615 |
if len(obj) >= |
|
|
614 | if len(obj) >= p.max_seq_length: | |
|
616 | 615 | p.text(',') |
|
617 | 616 | p.breakable() |
|
618 | 617 | p.text('...') |
@@ -648,13 +647,13 b' def _set_pprinter_factory(start, end, basetype):' | |||
|
648 | 647 | except Exception: |
|
649 | 648 | # Sometimes the items don't sort. |
|
650 | 649 | pass |
|
651 |
for idx, x in _enumerate(items, |
|
|
650 | for idx, x in _enumerate(items, p.max_seq_length): | |
|
652 | 651 | if idx: |
|
653 | 652 | p.text(',') |
|
654 | 653 | p.breakable() |
|
655 | 654 | p.pretty(x) |
|
656 | 655 | |
|
657 |
if len(obj) >= |
|
|
656 | if len(obj) >= p.max_seq_length: | |
|
658 | 657 | p.text(',') |
|
659 | 658 | p.breakable() |
|
660 | 659 | p.text('...') |
@@ -682,7 +681,7 b' def _dict_pprinter_factory(start, end, basetype=None):' | |||
|
682 | 681 | except Exception as e: |
|
683 | 682 | # Sometimes the keys don't sort. |
|
684 | 683 | pass |
|
685 |
for idx, key in _enumerate(keys, |
|
|
684 | for idx, key in _enumerate(keys, p.max_seq_length): | |
|
686 | 685 | if idx: |
|
687 | 686 | p.text(',') |
|
688 | 687 | p.breakable() |
@@ -690,7 +689,7 b' def _dict_pprinter_factory(start, end, basetype=None):' | |||
|
690 | 689 | p.text(': ') |
|
691 | 690 | p.pretty(obj[key]) |
|
692 | 691 | |
|
693 |
if len(obj) >= |
|
|
692 | if len(obj) >= p.max_seq_length: | |
|
694 | 693 | p.text(',') |
|
695 | 694 | p.breakable() |
|
696 | 695 | p.text('...') |
General Comments 0
You need to be logged in to leave comments.
Login now