Skip to content

Commit 0752bca

Browse files
ghisvaileffigies
andauthored
ENH: Turn usans formatter to a one-liner
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent 9d627ba commit 0752bca

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

pydra/tasks/fsl/preprocess/susan.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@ def format_usans(field: ty.Sequence[ty.Tuple[str, float]]) -> str:
1515
>>> format_usans([('/path/to/file1', 10.5), ('/path/to/file2', 22.1)])
1616
'2 /path/to/file1 10.5 /path/to/file2 22.1'
1717
"""
18-
try:
19-
n_usans = len(field)
20-
except TypeError:
21-
n_usans = 0
22-
23-
if n_usans > 0:
24-
usan_bt = " ".join([f"{usan} {bt}" for usan, bt in field])
25-
return f"{n_usans} {usan_bt}"
26-
else:
27-
return f"{n_usans}"
18+
return " ".join([f"{len(field)}"] + [f"{usan} {bt}" for usan, bt in field])
2819

2920

3021
input_fields = [

0 commit comments

Comments
 (0)