##// END OF EJS Templates
stringutil: teach pprint() to recognize generators...
Gregory Szorc -
r39332:ce145f8e default
parent child Browse files
Show More
@@ -13,6 +13,7 b' import ast'
13 import codecs
13 import codecs
14 import re as remod
14 import re as remod
15 import textwrap
15 import textwrap
16 import types
16
17
17 from ..i18n import _
18 from ..i18n import _
18 from ..thirdparty import attr
19 from ..thirdparty import attr
@@ -64,6 +65,8 b' def pprint(o, bprefix=False):'
64 pprint(k, bprefix=bprefix) for k in sorted(o)))
65 pprint(k, bprefix=bprefix) for k in sorted(o)))
65 elif isinstance(o, tuple):
66 elif isinstance(o, tuple):
66 return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
67 return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
68 elif isinstance(o, types.GeneratorType):
69 return 'gen[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
67 else:
70 else:
68 return pycompat.byterepr(o)
71 return pycompat.byterepr(o)
69
72
General Comments 0
You need to be logged in to leave comments. Login now