Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 80d80bc

Browse files
STY: Apply ruff/flake8-comprehensions rule C419
C419 Unnecessary list comprehension
1 parent aa1ed9e commit 80d80bc

File tree

9 files changed

+17
-21
lines changed

9 files changed

+17
-21
lines changed

‎nipype/interfaces/ants/segmentation.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def _format_arg(self, opt, spec, val):
194194
priors_paths[0] % i for i in range(1, n_classes + 1)
195195
]
196196

197-
if not all([os.path.exists(p) for p in priors_paths]):
197+
if not all(os.path.exists(p) for p in priors_paths):
198198
raise FileNotFoundError(
199199
"One or more prior images do not exist: "
200200
"%s." % ", ".join(priors_paths)

‎nipype/interfaces/freesurfer/preprocess.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,11 @@ def _get_runs(self):
692692
if self.inputs.seq_list:
693693
if self.inputs.ignore_single_slice:
694694
if (int(s[8]) > 1) and any(
695-
[s[12].startswith(sn) for sn in self.inputs.seq_list]
695+
s[12].startswith(sn) for sn in self.inputs.seq_list
696696
):
697697
runs.append(int(s[2]))
698698
else:
699-
if any([s[12].startswith(sn) for sn in self.inputs.seq_list]):
699+
if any(s[12].startswith(sn) for sn in self.inputs.seq_list):
700700
runs.append(int(s[2]))
701701
else:
702702
runs.append(int(s[2]))

‎nipype/interfaces/fsl/model.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,8 +1503,8 @@ def _run_interface(self, runtime):
15031503
regs = sorted(self.inputs.regressors.keys())
15041504
nwaves = len(regs)
15051505
npoints = len(self.inputs.regressors[regs[0]])
1506-
ntcons = sum([1 for con in self.inputs.contrasts if con[1] == "T"])
1507-
nfcons = sum([1 for con in self.inputs.contrasts if con[1] == "F"])
1506+
ntcons = sum(1 for con in self.inputs.contrasts if con[1] == "T")
1507+
nfcons = sum(1 for con in self.inputs.contrasts if con[1] == "F")
15081508
# write mat file
15091509
mat_txt = ["/NumWaves %d" % nwaves, "/NumPoints %d" % npoints]
15101510
ppheights = []
@@ -1591,7 +1591,7 @@ def _run_interface(self, runtime):
15911591

15921592
def _list_outputs(self):
15931593
outputs = self._outputs().get()
1594-
nfcons = sum([1 for con in self.inputs.contrasts if con[1] == "F"])
1594+
nfcons = sum(1 for con in self.inputs.contrasts if con[1] == "F")
15951595
for field in list(outputs.keys()):
15961596
if ("fts" in field) and (nfcons == 0):
15971597
continue

‎nipype/interfaces/io.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ def _list_outputs(self):
10251025
if self.inputs.sort_filelist:
10261026
outfiles = human_order_sorted(outfiles)
10271027
outputs[key].append(simplify_list(outfiles))
1028-
if any([val is None for val in outputs[key]]):
1028+
if any(val is None for val in outputs[key]):
10291029
outputs[key] = []
10301030
if len(outputs[key]) == 0:
10311031
outputs[key] = None
@@ -1300,7 +1300,7 @@ def _list_outputs(self):
13001300
if self.inputs.drop_blank_outputs:
13011301
outputs[key] = [x for x in outputs[key] if x is not None]
13021302
else:
1303-
if any([val is None for val in outputs[key]]):
1303+
if any(val is None for val in outputs[key]):
13041304
outputs[key] = []
13051305
if len(outputs[key]) == 0:
13061306
outputs[key] = None
@@ -2645,7 +2645,7 @@ def _list_outputs(self):
26452645
outputs[key].append(self._get_files_over_ssh(filledtemplate))
26462646

26472647
# disclude where there was any invalid matches
2648-
if any([val is None for val in outputs[key]]):
2648+
if any(val is None for val in outputs[key]):
26492649
outputs[key] = []
26502650

26512651
# no outputs is None, not empty list

‎nipype/pipeline/engine/nodes.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ def _collate_results(self, nodes):
12831283
)
12841284
setattr(finalresult.outputs, key, values)
12851285

1286-
if returncode and any([code is not None for code in returncode]):
1286+
if returncode and any(code is not None for code in returncode):
12871287
msg = []
12881288
for i, code in enumerate(returncode):
12891289
if code is not None:

‎nipype/pipeline/engine/utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ def clean_working_directory(
14851485
if f not in needed_files:
14861486
if not needed_dirs:
14871487
files2remove.append(f)
1488-
elif not any([f.startswith(dname) for dname in needed_dirs]):
1488+
elif not any(f.startswith(dname) for dname in needed_dirs):
14891489
files2remove.append(f)
14901490
else:
14911491
if not str2bool(config["execution"]["keep_inputs"]):

‎nipype/pipeline/engine/workflows.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,8 @@ def connect(self, *args, **kwargs):
191191
and (
192192
".io" in str(destnode._interface.__class__)
193193
or any(
194-
[
195-
".io" in str(val)
196-
for val in destnode._interface.__class__.__bases__
197-
]
194+
".io" in str(val)
195+
for val in destnode._interface.__class__.__bases__
198196
)
199197
)
200198
):
@@ -205,10 +203,8 @@ def connect(self, *args, **kwargs):
205203
and (
206204
".io" in str(srcnode._interface.__class__)
207205
or any(
208-
[
209-
".io" in str(val)
210-
for val in srcnode._interface.__class__.__bases__
211-
]
206+
".io" in str(val)
207+
for val in srcnode._interface.__class__.__bases__
212208
)
213209
)
214210
):

‎nipype/utils/docparse.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def _parse_doc(doc, style=["--"]):
283283
flag = [
284284
item
285285
for i, item in enumerate(linelist)
286-
if i < 2 and any([item.startswith(s) for s in style]) and len(item) > 1
286+
if i < 2 and any(item.startswith(s) for s in style) and len(item) > 1
287287
]
288288
if flag:
289289
if len(flag) == 1:

‎nipype/utils/misc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def trim(docstring, marker=None):
5353
if (
5454
marker is not None
5555
and stripped
56-
and all([s == stripped[0] for s in stripped])
56+
and all(s == stripped[0] for s in stripped)
5757
and stripped[0] not in [":"]
5858
):
5959
line = line.replace(stripped[0], marker)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /