Skip to content

Commit 7f48e94

Browse files
committed
Reorganized exception catching in _strip_header() for better code clarity
- Cleanup suggested by @effigies
1 parent c0d7cad commit 7f48e94

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

nipype/utils/spm_docs.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ def _strip_header(doc):
5151
cruft = '\x1b'
5252
try:
5353
index = doc.index(hdr)
54-
index += len(hdr)
55-
index += 1
56-
doc = doc[index:]
57-
try:
58-
index = doc.index(cruft)
59-
except ValueError:
60-
index = len(doc)
61-
return doc[:index]
6254
except ValueError as e:
6355
raise_from(IOError('This docstring was not generated by Nipype!\n'), e)
56+
57+
index += len(hdr)
58+
index += 1
59+
doc = doc[index:]
60+
try:
61+
index = doc.index(cruft)
62+
except ValueError:
63+
index = len(doc)
64+
return doc[:index]

0 commit comments

Comments
 (0)