Show More
@@ -920,10 +920,20 b' def _counter_pprint(obj, p, cycle):' | |||||
920 | else: |
|
920 | else: | |
921 | p.pretty(cls_ctor()) |
|
921 | p.pretty(cls_ctor()) | |
922 |
|
922 | |||
|
923 | ||||
|
924 | def _userlist_pprint(obj, p, cycle): | |||
|
925 | cls_ctor = CallExpression.factory(obj.__class__.__name__) | |||
|
926 | if cycle: | |||
|
927 | p.pretty(cls_ctor(RawText("..."))) | |||
|
928 | else: | |||
|
929 | p.pretty(cls_ctor(list(obj))) | |||
|
930 | ||||
|
931 | ||||
923 | for_type_by_name('collections', 'defaultdict', _defaultdict_pprint) |
|
932 | for_type_by_name('collections', 'defaultdict', _defaultdict_pprint) | |
924 | for_type_by_name('collections', 'OrderedDict', _ordereddict_pprint) |
|
933 | for_type_by_name('collections', 'OrderedDict', _ordereddict_pprint) | |
925 | for_type_by_name('collections', 'deque', _deque_pprint) |
|
934 | for_type_by_name('collections', 'deque', _deque_pprint) | |
926 | for_type_by_name('collections', 'Counter', _counter_pprint) |
|
935 | for_type_by_name('collections', 'Counter', _counter_pprint) | |
|
936 | for_type_by_name("collections", "UserList", _userlist_pprint) | |||
927 |
|
937 | |||
928 | if __name__ == '__main__': |
|
938 | if __name__ == '__main__': | |
929 | from random import randrange |
|
939 | from random import randrange |
General Comments 0
You need to be logged in to leave comments.
Login now