Skip to content

Commit b366e91

Browse files
committed
add replacement for textwrap.indent
1 parent 8915591 commit b366e91

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

nipype/pipeline/plugins/multiproc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from multiprocessing import Process, Pool, cpu_count, pool
1313
from traceback import format_exception
1414
import sys
15-
from textwrap import indent
1615
from logging import INFO
1716

1817
from copy import deepcopy
@@ -22,6 +21,16 @@
2221
from ..engine import MapNode
2322
from .base import DistributedPluginBase
2423

24+
try:
25+
from textwrap import indent
26+
except ImportError:
27+
def indent(text, prefix):
28+
""" A textwrap.indent replacement for Python < 3.3 """
29+
if not prefix:
30+
return text
31+
splittext = text.splitlines(True)
32+
return prefix + prefix.join(splittext)
33+
2534
# Init logger
2635
logger = logging.getLogger('workflow')
2736

0 commit comments

Comments
 (0)