Skip to content

Commit 6bd611f

Browse files
committed
FIX: Correct call of indent; drop compatibility shim
1 parent f159055 commit 6bd611f

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

nipype/utils/misc.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@
1313

1414
import numpy as np
1515

16-
try:
17-
from textwrap import indent as textwrap_indent
18-
except ImportError:
19-
20-
def textwrap_indent(text, prefix):
21-
"""A textwrap.indent replacement for Python < 3.3"""
22-
if not prefix:
23-
return text
24-
splittext = text.splitlines(True)
25-
return prefix + prefix.join(splittext)
16+
import textwrap
2617

2718

2819
def human_order_sorted(l):
@@ -299,11 +290,12 @@ def dict_diff(dold, dnew, indent=0):
299290
try:
300291
dnew, dold = dict(dnew), dict(dold)
301292
except Exception:
302-
return textwrap_indent(
293+
return textwrap.indent(
303294
f"""\
304295
Diff between nipype inputs failed:
305296
* Cached inputs: {dold}
306-
* New inputs: {dnew}"""
297+
* New inputs: {dnew}""",
298+
" " * indent
307299
)
308300

309301
# Compare against hashed_inputs
@@ -353,7 +345,7 @@ def _uniformize(val):
353345
if len(diff) > diffkeys:
354346
diff.insert(diffkeys, "Some dictionary entries had differing values:")
355347

356-
return textwrap_indent("\n".join(diff), " " * indent)
348+
return textwrap.indent("\n".join(diff), " " * indent)
357349

358350

359351
def rgetcwd(error=True):

0 commit comments

Comments
 (0)