Show More
@@ -95,6 +95,7 b" __all__ = ['pretty', 'pprint', 'PrettyPrinter', 'RepresentationPrinter'," | |||||
95 |
|
95 | |||
96 |
|
96 | |||
97 | MAX_SEQ_LENGTH = 1000 |
|
97 | MAX_SEQ_LENGTH = 1000 | |
|
98 | DICT_IS_ORDERED = sys.version_info >= (3, 7) | |||
98 | _re_pattern_type = type(re.compile('')) |
|
99 | _re_pattern_type = type(re.compile('')) | |
99 |
|
100 | |||
100 | def _safe_getattr(obj, attr, default=None): |
|
101 | def _safe_getattr(obj, attr, default=None): | |
@@ -613,7 +614,9 b' def _dict_pprinter_factory(start, end, basetype=None):' | |||||
613 | p.begin_group(step, start) |
|
614 | p.begin_group(step, start) | |
614 | keys = obj.keys() |
|
615 | keys = obj.keys() | |
615 | # if dict isn't large enough to be truncated, sort keys before displaying |
|
616 | # if dict isn't large enough to be truncated, sort keys before displaying | |
616 | if not (p.max_seq_length and len(obj) >= p.max_seq_length): |
|
617 | # From Python 3.7, dicts preserve order by definition, so we don't sort. | |
|
618 | if not DICT_IS_ORDERED \ | |||
|
619 | and not (p.max_seq_length and len(obj) >= p.max_seq_length): | |||
617 | keys = _sorted_for_pprint(keys) |
|
620 | keys = _sorted_for_pprint(keys) | |
618 | for idx, key in p._enumerate(keys): |
|
621 | for idx, key in p._enumerate(keys): | |
619 | if idx: |
|
622 | if idx: |
General Comments 0
You need to be logged in to leave comments.
Login now