Sort the given items for pretty printing. Since some predictable sorting is better than no sorting at all, we sort on the string representation if normal sorting fails.
(items)
| 136 | return default |
| 137 | |
| 138 | def _sorted_for_pprint(items): |
| 139 | """ |
| 140 | Sort the given items for pretty printing. Since some predictable |
| 141 | sorting is better than no sorting at all, we sort on the string |
| 142 | representation if normal sorting fails. |
| 143 | """ |
| 144 | items = list(items) |
| 145 | try: |
| 146 | return sorted(items) |
| 147 | except Exception: |
| 148 | try: |
| 149 | return sorted(items, key=str) |
| 150 | except Exception: |
| 151 | return items |
| 152 | |
| 153 | def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH): |
| 154 | """ |
no outgoing calls
no test coverage detected
searching dependent graphs…