##// END OF EJS Templates
only sort small dicts and sets in lib.pretty...
MinRK -
Show More
@@ -592,10 +592,11 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 = list(obj)
596 items = obj
597 if not (p.max_seq_length and len(obj) >= p.max_seq_length):
597 try:
598 try:
598 items.sort()
599 items = sorted(obj)
599 except Exception:
600 except Exception:
600 # Sometimes the items don't sort.
601 # Sometimes the items don't sort.
601 pass
602 pass
@@ -623,9 +624,11 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()
627 # if dict isn't large enough to be truncated, sort keys before displaying
628 if not (p.max_seq_length and len(obj) >= p.max_seq_length):
626 try:
629 try:
627 keys.sort()
630 keys = sorted(keys)
628 except Exception as e:
631 except Exception:
629 # Sometimes the keys don't sort.
632 # Sometimes the keys don't sort.
630 pass
633 pass
631 for idx, key in p._enumerate(keys):
634 for idx, key in p._enumerate(keys):
General Comments 0
You need to be logged in to leave comments. Login now