Mercurial > hg-stable
comparison mercurial/utils/stringutil.py @ 37976:bf6bb710b40f
stringutil: teach pprint about tuples
Differential Revision: https://phab.mercurial-scm.org/D3521
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 13:15:16 -0400 |
parents | f7194c925003 |
children | af83a0ed0afb |
comparison
equal
deleted
inserted
replaced
37975:faa41fd282d1 | 37976:bf6bb710b40f |
---|---|
44 return b'True' if o else b'False' | 44 return b'True' if o else b'False' |
45 elif isinstance(o, int): | 45 elif isinstance(o, int): |
46 return '%d' % o | 46 return '%d' % o |
47 elif isinstance(o, float): | 47 elif isinstance(o, float): |
48 return '%f' % o | 48 return '%f' % o |
49 elif isinstance(o, tuple): | |
50 return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o)) | |
49 elif o is None: | 51 elif o is None: |
50 return b'None' | 52 return b'None' |
51 else: | 53 else: |
52 raise error.ProgrammingError('do not know how to format %r' % o) | 54 raise error.ProgrammingError('do not know how to format %r' % o) |
53 | 55 |