Skip to content

Commit 0f24374

Browse files
STY: Apply ruff/flake8-simplify rule SIM110
SIM110 Use `return any(...)` instead of `for` loop
1 parent d6d726e commit 0f24374

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

niworkflows/utils/spaces.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,7 @@ def __contains__(self, item):
521521
if not self.references:
522522
return False
523523
item = self.check_space(item)
524-
for s in self.references:
525-
if s == item:
526-
return True
527-
return False
524+
return any(s == item for s in self.references)
528525

529526
def __str__(self):
530527
"""
@@ -730,10 +727,7 @@ def __call__(self, parser, namespace, values, option_string=None):
730727

731728
def hasspec(value, specs):
732729
"""Check whether any of the keys are in a dict."""
733-
for s in specs:
734-
if s in value:
735-
return True
736-
return False
730+
return any(s in value for s in specs)
737731

738732

739733
def format_reference(in_tuple):

0 commit comments

Comments
 (0)