mirror of https://github.com/python/cpython
Fix a bug from the map->itertools.imap conversion.
This commit is contained in:
parent
2698631d57
commit
72e110c1cd
|
@ -986,8 +986,7 @@ class TextDoc(Doc):
|
||||||
def indent(self, text, prefix=' '):
|
def indent(self, text, prefix=' '):
|
||||||
"""Indent text by prepending a given prefix to each line."""
|
"""Indent text by prepending a given prefix to each line."""
|
||||||
if not text: return ''
|
if not text: return ''
|
||||||
lines = text.split('\n')
|
lines = [prefix + line for line in text.split('\n')]
|
||||||
lines = map(lambda line, prefix=prefix: prefix + line, lines)
|
|
||||||
if lines: lines[-1] = lines[-1].rstrip()
|
if lines: lines[-1] = lines[-1].rstrip()
|
||||||
return '\n'.join(lines)
|
return '\n'.join(lines)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue