diff --git a/nipype/interfaces/ants/segmentation.py b/nipype/interfaces/ants/segmentation.py index 76c0ef152d..f3af7857d1 100644 --- a/nipype/interfaces/ants/segmentation.py +++ b/nipype/interfaces/ants/segmentation.py @@ -186,7 +186,7 @@ def _format_arg(self, opt, spec, val): priors_paths[0] % i for i in range(1, n_classes + 1) ] - if not all([os.path.exists(p) for p in priors_paths]): + if not all(os.path.exists(p) for p in priors_paths): raise FileNotFoundError( "One or more prior images do not exist: " "%s." % ", ".join(priors_paths) diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index a3e44b66ba..e70e4deafc 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -691,11 +691,11 @@ def _get_runs(self): if self.inputs.seq_list: if self.inputs.ignore_single_slice: if (int(s[8]) > 1) and any( - [s[12].startswith(sn) for sn in self.inputs.seq_list] + s[12].startswith(sn) for sn in self.inputs.seq_list ): runs.append(int(s[2])) else: - if any([s[12].startswith(sn) for sn in self.inputs.seq_list]): + if any(s[12].startswith(sn) for sn in self.inputs.seq_list): runs.append(int(s[2])) else: runs.append(int(s[2])) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index cee2002eb9..f30a2ddd18 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1024,7 +1024,7 @@ def _list_outputs(self): if self.inputs.sort_filelist: outfiles = human_order_sorted(outfiles) outputs[key].append(simplify_list(outfiles)) - if any([val is None for val in outputs[key]]): + if any(val is None for val in outputs[key]): outputs[key] = [] if len(outputs[key]) == 0: outputs[key] = None @@ -1299,7 +1299,7 @@ def _list_outputs(self): if self.inputs.drop_blank_outputs: outputs[key] = [x for x in outputs[key] if x is not None] else: - if any([val is None for val in outputs[key]]): + if any(val is None for val in outputs[key]): outputs[key] = [] if len(outputs[key]) == 0: outputs[key] = None @@ -2644,7 +2644,7 @@ def _list_outputs(self): outputs[key].append(self._get_files_over_ssh(filledtemplate)) # disclude where there was any invalid matches - if any([val is None for val in outputs[key]]): + if any(val is None for val in outputs[key]): outputs[key] = [] # no outputs is None, not empty list diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 9c567a307d..5f357abb00 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -1283,7 +1283,7 @@ def _collate_results(self, nodes): ) setattr(finalresult.outputs, key, values) - if returncode and any([code is not None for code in returncode]): + if returncode and any(code is not None for code in returncode): msg = [] for i, code in enumerate(returncode): if code is not None: diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index e21c484f59..b03f61275a 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -1485,7 +1485,7 @@ def clean_working_directory( if f not in needed_files: if not needed_dirs: files2remove.append(f) - elif not any([f.startswith(dname) for dname in needed_dirs]): + elif not any(f.startswith(dname) for dname in needed_dirs): files2remove.append(f) else: if not str2bool(config["execution"]["keep_inputs"]): diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index fd7c8b9cd0..e99b19eb25 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -191,10 +191,8 @@ def connect(self, *args, **kwargs): and ( ".io" in str(destnode._interface.__class__) or any( - [ - ".io" in str(val) - for val in destnode._interface.__class__.__bases__ - ] + ".io" in str(val) + for val in destnode._interface.__class__.__bases__ ) ) ): @@ -205,10 +203,8 @@ def connect(self, *args, **kwargs): and ( ".io" in str(srcnode._interface.__class__) or any( - [ - ".io" in str(val) - for val in srcnode._interface.__class__.__bases__ - ] + ".io" in str(val) + for val in srcnode._interface.__class__.__bases__ ) ) ): diff --git a/nipype/utils/docparse.py b/nipype/utils/docparse.py index 0cbaf1ff07..c29e0655d7 100644 --- a/nipype/utils/docparse.py +++ b/nipype/utils/docparse.py @@ -283,7 +283,7 @@ def _parse_doc(doc, style=["--"]): flag = [ item for i, item in enumerate(linelist) - if i < 2 and any([item.startswith(s) for s in style]) and len(item) > 1 + if i < 2 and any(item.startswith(s) for s in style) and len(item) > 1 ] if flag: if len(flag) == 1: diff --git a/nipype/utils/misc.py b/nipype/utils/misc.py index baafbf29d2..2d9a100f3c 100644 --- a/nipype/utils/misc.py +++ b/nipype/utils/misc.py @@ -53,7 +53,7 @@ def trim(docstring, marker=None): if ( marker is not None and stripped - and all([s == stripped[0] for s in stripped]) + and all(s == stripped[0] for s in stripped) and stripped[0] not in [":"] ): line = line.replace(stripped[0], marker)