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