Show More
@@ -592,13 +592,14 b' def _set_pprinter_factory(start, end, basetype):' | |||||
592 | else: |
|
592 | else: | |
593 | step = len(start) |
|
593 | step = len(start) | |
594 | p.begin_group(step, start) |
|
594 | p.begin_group(step, start) | |
595 |
# Like dictionary keys, we will try to sort the items |
|
595 | # Like dictionary keys, we will try to sort the items if there aren't too many | |
596 |
items = |
|
596 | items = obj | |
597 | try: |
|
597 | if not (p.max_seq_length and len(obj) >= p.max_seq_length): | |
598 |
|
|
598 | try: | |
599 | except Exception: |
|
599 | items = sorted(obj) | |
600 | # Sometimes the items don't sort. |
|
600 | except Exception: | |
601 | pass |
|
601 | # Sometimes the items don't sort. | |
|
602 | pass | |||
602 | for idx, x in p._enumerate(items): |
|
603 | for idx, x in p._enumerate(items): | |
603 | if idx: |
|
604 | if idx: | |
604 | p.text(',') |
|
605 | p.text(',') | |
@@ -623,11 +624,13 b' def _dict_pprinter_factory(start, end, basetype=None):' | |||||
623 | return p.text('{...}') |
|
624 | return p.text('{...}') | |
624 | p.begin_group(1, start) |
|
625 | p.begin_group(1, start) | |
625 | keys = obj.keys() |
|
626 | keys = obj.keys() | |
626 | try: |
|
627 | # if dict isn't large enough to be truncated, sort keys before displaying | |
627 | keys.sort() |
|
628 | if not (p.max_seq_length and len(obj) >= p.max_seq_length): | |
628 | except Exception as e: |
|
629 | try: | |
629 |
|
|
630 | keys = sorted(keys) | |
630 | pass |
|
631 | except Exception: | |
|
632 | # Sometimes the keys don't sort. | |||
|
633 | pass | |||
631 | for idx, key in p._enumerate(keys): |
|
634 | for idx, key in p._enumerate(keys): | |
632 | if idx: |
|
635 | if idx: | |
633 | p.text(',') |
|
636 | p.text(',') |
General Comments 0
You need to be logged in to leave comments.
Login now