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 8b4c8ef

Browse files
STY: Apply ruff/flake8-comprehensions rule C419
C419 Unnecessary list comprehension
1 parent fedef7a commit 8b4c8ef

File tree

8 files changed

+14
-18
lines changed

8 files changed

+14
-18
lines changed

‎nipype/interfaces/ants/segmentation.py‎

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

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

‎nipype/interfaces/freesurfer/preprocess.py‎

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

‎nipype/interfaces/io.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def _list_outputs(self):
10241024
if self.inputs.sort_filelist:
10251025
outfiles = human_order_sorted(outfiles)
10261026
outputs[key].append(simplify_list(outfiles))
1027-
if any([val is None for val in outputs[key]]):
1027+
if any(val is None for val in outputs[key]):
10281028
outputs[key] = []
10291029
if len(outputs[key]) == 0:
10301030
outputs[key] = None
@@ -1299,7 +1299,7 @@ def _list_outputs(self):
12991299
if self.inputs.drop_blank_outputs:
13001300
outputs[key] = [x for x in outputs[key] if x is not None]
13011301
else:
1302-
if any([val is None for val in outputs[key]]):
1302+
if any(val is None for val in outputs[key]):
13031303
outputs[key] = []
13041304
if len(outputs[key]) == 0:
13051305
outputs[key] = None
@@ -2644,7 +2644,7 @@ def _list_outputs(self):
26442644
outputs[key].append(self._get_files_over_ssh(filledtemplate))
26452645

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

26502650
# 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 によって変換されたページ (->オリジナル) /