Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGbf6bb710b40f: stringutil: teach pprint about tuples
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
pprint(v, bprefix=bprefix)) | pprint(v, bprefix=bprefix)) | ||||
for k, v in sorted(o.items()))) | for k, v in sorted(o.items()))) | ||||
elif isinstance(o, bool): | elif isinstance(o, bool): | ||||
return b'True' if o else b'False' | return b'True' if o else b'False' | ||||
elif isinstance(o, int): | elif isinstance(o, int): | ||||
return '%d' % o | return '%d' % o | ||||
elif isinstance(o, float): | elif isinstance(o, float): | ||||
return '%f' % o | return '%f' % o | ||||
elif isinstance(o, tuple): | |||||
return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o)) | |||||
elif o is None: | elif o is None: | ||||
return b'None' | return b'None' | ||||
else: | else: | ||||
raise error.ProgrammingError('do not know how to format %r' % o) | raise error.ProgrammingError('do not know how to format %r' % o) | ||||
def binary(s): | def binary(s): | ||||
"""return true if a string is binary data""" | """return true if a string is binary data""" | ||||
return bool(s and '\0' in s) | return bool(s and '\0' in s) |