# HG changeset patch # User Augie Fackler # Date 1495993302 14400 # Node ID 6e9a2c9c1f3754b83aa805bb394530a20a56f67d # Parent 1fb0a85fb20ecc7c35153ea5d2fa5ef59d3347ce minirst: use bytes.strip instead of str.strip diff -r 1fb0a85fb20e -r 6e9a2c9c1f37 mercurial/minirst.py --- a/mercurial/minirst.py Mon May 29 16:21:15 2017 +0530 +++ b/mercurial/minirst.py Sun May 28 13:41:42 2017 -0400 @@ -452,7 +452,7 @@ } def formatoption(block, width): - desc = ' '.join(map(str.strip, block['lines'])) + desc = ' '.join(map(bytes.strip, block['lines'])) colwidth = encoding.colwidth(block['optstr']) usablewidth = width - 1 hanging = block['optstrwidth'] @@ -474,7 +474,7 @@ hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) defindent = indent + hang * ' ' - text = ' '.join(map(str.strip, block['lines'])) + text = ' '.join(map(bytes.strip, block['lines'])) return '%s\n%s\n' % (indent + admonition, util.wrap(text, width=width, initindent=defindent, @@ -512,7 +512,7 @@ term = indent + block['lines'][0] hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) defindent = indent + hang * ' ' - text = ' '.join(map(str.strip, block['lines'][1:])) + text = ' '.join(map(bytes.strip, block['lines'][1:])) return '%s\n%s\n' % (term, util.wrap(text, width=width, initindent=defindent, hangindent=defindent)) @@ -567,7 +567,7 @@ if btype == 'admonition': admonition = escape(_admonitiontitles[b['admonitiontitle']]) - text = escape(' '.join(map(str.strip, lines))) + text = escape(' '.join(map(bytes.strip, lines))) out.append('

\n%s %s\n

\n' % (admonition, text)) elif btype == 'paragraph': out.append('

\n%s\n

\n' % escape('\n'.join(lines))) @@ -597,7 +597,7 @@ elif btype == 'definition': openlist('dl', level) term = escape(lines[0]) - text = escape(' '.join(map(str.strip, lines[1:]))) + text = escape(' '.join(map(bytes.strip, lines[1:]))) out.append('
%s\n
%s\n' % (term, text)) elif btype == 'bullet': bullet, head = lines[0].split(' ', 1) @@ -609,12 +609,12 @@ elif btype == 'field': openlist('dl', level) key = escape(b['key']) - text = escape(' '.join(map(str.strip, lines))) + text = escape(' '.join(map(bytes.strip, lines))) out.append('
%s\n
%s\n' % (key, text)) elif btype == 'option': openlist('dl', level) opt = escape(b['optstr']) - desc = escape(' '.join(map(str.strip, lines))) + desc = escape(' '.join(map(bytes.strip, lines))) out.append('
%s\n
%s\n' % (opt, desc)) # close lists if indent level of next block is lower