Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nipype/interfaces/base/tests/test_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class DeprecationSpec3(nib.TraitedSpec):
except nib.TraitError:
not_raised = False
assert not_raised
assert len(w) == 1, "deprecated warning 1 %s" % [w1.message for w1 in w]
assert len(w) == 1, f"deprecated warning 1 {[str(w1) for w1 in w]}"

with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always", "", UserWarning)
Expand All @@ -201,7 +201,7 @@ class DeprecationSpec3(nib.TraitedSpec):
assert not_raised
assert spec_instance.foo == Undefined
assert spec_instance.bar == 1
assert len(w) == 1, "deprecated warning 2 %s" % [w1.message for w1 in w]
assert len(w) == 1, f"deprecated warning 2 {[str(w1) for w1 in w]}"


def test_namesource(setup_file):
Expand Down
21 changes: 6 additions & 15 deletions nipype/interfaces/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,11 +1010,8 @@ def _list_outputs(self):
try:
filledtemplate = template % tuple(argtuple)
except TypeError as e:
raise TypeError(
e.message
+ ": Template %s failed to convert with args %s"
% (template, str(tuple(argtuple)))
)
raise TypeError(f"{e}: Template {template} failed to convert "
f"with args {tuple(argtuple)}")
outfiles = []
for fname in bkt_files:
if re.match(filledtemplate, fname):
Expand Down Expand Up @@ -1286,11 +1283,8 @@ def _list_outputs(self):
try:
filledtemplate = template % tuple(argtuple)
except TypeError as e:
raise TypeError(
e.message
+ ": Template %s failed to convert with args %s"
% (template, str(tuple(argtuple)))
)
raise TypeError(f"{e}: Template {template} failed to convert "
f"with args {tuple(argtuple)}")
outfiles = glob.glob(filledtemplate)
if len(outfiles) == 0:
msg = "Output key: %s Template: %s returned no files" % (
Expand Down Expand Up @@ -2664,11 +2658,8 @@ def _list_outputs(self):
try:
filledtemplate = template % tuple(argtuple)
except TypeError as e:
raise TypeError(
e.message
+ ": Template %s failed to convert with args %s"
% (template, str(tuple(argtuple)))
)
raise TypeError(f"{e}: Template {template} failed to convert "
f"with args {tuple(argtuple)}")

outputs[key].append(self._get_files_over_ssh(filledtemplate))

Expand Down
8 changes: 3 additions & 5 deletions nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def copyfile(
fmlogger.debug("Copying File: %s->%s", newfile, originalfile)
shutil.copyfile(originalfile, newfile)
except shutil.Error as e:
fmlogger.warning(e.message)
fmlogger.warning(str(e))

# Associated files
if copy_related_files:
Expand Down Expand Up @@ -870,10 +870,8 @@ def get_dependencies(name, environ):
o, e = proc.communicate()
deps = o.rstrip()
except Exception as ex:
deps = '"%s" failed' % command
fmlogger.warning(
"Could not get dependencies of %s. Error:\n%s", name, ex.message
)
deps = f'{command!r} failed'
fmlogger.warning(f"Could not get dependencies of {name}s. Error:\n{ex}")
return deps


Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _process(drain=0):
res = select.select(streams, [], [], timeout)
except select.error as e:
iflogger.info(e)
if e[0] == errno.EINTR:
if e.errno == errno.EINTR:
return
else:
raise
Expand Down