Skip to content
Snippets Groups Projects
Commit f95b7068 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

MNT: change to f-strings

parent 6e8de485
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ def imcp(src, ...@@ -57,7 +57,7 @@ def imcp(src,
# special case - non-existent directory # special case - non-existent directory
if dest.endswith('/') and not op.isdir(dest): if dest.endswith('/') and not op.isdir(dest):
raise fslpath.PathError('Directory does not exist: {}'.format(dest)) raise fslpath.PathError(f'Directory does not exist: {dest}')
if op.isdir(dest): if op.isdir(dest):
dest = op.join(dest, op.basename(src)) dest = op.join(dest, op.basename(src))
...@@ -87,7 +87,7 @@ def imcp(src, ...@@ -87,7 +87,7 @@ def imcp(src,
if not op.exists(src): if not op.exists(src):
raise fslpath.PathError('imcp error - source path ' raise fslpath.PathError('imcp error - source path '
'does not exist: {}'.format(src)) f'does not exist: {src}')
# Figure out the destination file # Figure out the destination file
# extension/type. If useDefaultExt # extension/type. If useDefaultExt
...@@ -116,10 +116,10 @@ def imcp(src, ...@@ -116,10 +116,10 @@ def imcp(src,
# Give up if we don't have permission. # Give up if we don't have permission.
if not os.access(op.dirname(dest), os.W_OK | os.X_OK): if not os.access(op.dirname(dest), os.W_OK | os.X_OK):
raise fslpath.PathError('imcp error - cannot write to {}'.format(dest)) raise fslpath.PathError(f'imcp error - cannot write to {dest}')
if move and not os.access(op.dirname(src), os.W_OK | os.X_OK): if move and not os.access(op.dirname(src), os.W_OK | os.X_OK):
raise fslpath.PathError('imcp error - cannot move from {}'.format(src)) raise fslpath.PathError(f'imcp error - cannot move from {src}')
# If the source file type does not # If the source file type does not
# match the destination file type, # match the destination file type,
...@@ -132,8 +132,8 @@ def imcp(src, ...@@ -132,8 +132,8 @@ def imcp(src,
if srcExt != destExt: if srcExt != destExt:
if not overwrite and op.exists(dest): if not overwrite and op.exists(dest):
raise fslpath.PathError('imcp error - destination already ' raise fslpath.PathError('imcp error - destination '
'exists ({})'.format(dest)) f'already exists ({dest})')
img = nib.load(src) img = nib.load(src)
nib.save(img, dest) nib.save(img, dest)
...@@ -193,7 +193,7 @@ def imcp(src, ...@@ -193,7 +193,7 @@ def imcp(src,
# paths already exist # paths already exist
if not overwrite and any([op.exists(d) for d in copyDests]): if not overwrite and any([op.exists(d) for d in copyDests]):
raise fslpath.PathError('imcp error - a destination path already ' raise fslpath.PathError('imcp error - a destination path already '
'exists ({})'.format(', '.join(copyDests))) f'exists ({', '.join(copyDests)})')
# Do the copy/move # Do the copy/move
for src, dest in zip(copySrcs, copyDests): for src, dest in zip(copySrcs, copyDests):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment