Skip to content

Commit df2b0b7

Browse files
STY: Apply ruff/Perflint rule PERF403
PERF403 Use a dictionary comprehension instead of a for-loop
1 parent e62aef0 commit df2b0b7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nipype/interfaces/io.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,16 +2717,14 @@ class JSONFileGrabber(IOBase):
27172717
def _list_outputs(self):
27182718
import simplejson
27192719

2720-
outputs = {}
27212720
if isdefined(self.inputs.in_file):
27222721
with open(self.inputs.in_file) as f:
2723-
data = simplejson.load(f)
2722+
outputs = simplejson.load(f)
27242723

2725-
if not isinstance(data, dict):
2724+
if not isinstance(outputs, dict):
27262725
raise RuntimeError("JSON input has no dictionary structure")
2727-
2728-
for key, value in list(data.items()):
2729-
outputs[key] = value
2726+
else:
2727+
outputs = {}
27302728

27312729
if isdefined(self.inputs.defaults):
27322730
defaults = self.inputs.defaults

0 commit comments

Comments
 (0)