Skip to content

Commit 0befcf4

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

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
@@ -2720,16 +2720,14 @@ class JSONFileGrabber(IOBase):
27202720
def _list_outputs(self):
27212721
import simplejson
27222722

2723-
outputs = {}
27242723
if isdefined(self.inputs.in_file):
27252724
with open(self.inputs.in_file) as f:
2726-
data = simplejson.load(f)
2725+
outputs = simplejson.load(f)
27272726

2728-
if not isinstance(data, dict):
2727+
if not isinstance(outputs, dict):
27292728
raise RuntimeError("JSON input has no dictionary structure")
2730-
2731-
for key, value in list(data.items()):
2732-
outputs[key] = value
2729+
else:
2730+
outputs = {}
27332731

27342732
if isdefined(self.inputs.defaults):
27352733
defaults = self.inputs.defaults

0 commit comments

Comments
 (0)