Skip to content

Commit f321ca3

Browse files
committed
chore: Update pretty_mapping to use f-strings
1 parent a274579 commit f321ca3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

nibabel/volumeutils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,7 @@ def pretty_mapping(
338338
if getterfunc is None:
339339
getterfunc = getitem
340340
mxlen = max(len(str(name)) for name in mapping)
341-
fmt = '%%-%ds : %%s' % mxlen
342-
out = []
343-
for name in mapping:
344-
value = getterfunc(mapping, name)
345-
out.append(fmt % (name, value))
346-
return '\n'.join(out)
341+
return '\n'.join([f'{name:{mxlen}s} : {getterfunc(mapping, name)}' for name in mapping])
347342

348343

349344
def make_dt_codes(codes_seqs: ty.Sequence[ty.Sequence]) -> Recoder:

0 commit comments

Comments
 (0)