Skip to content

Commit bf59ed6

Browse files
[pylint consider-using-any-or-all] Use all instead of a loop
1 parent 27b1dd6 commit bf59ed6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ disable = [
213213
"condition-evals-to-constant",
214214
"consider-alternative-union-syntax",
215215
"confusing-consecutive-elif",
216-
"consider-using-any-or-all",
217216
"consider-using-assignment-expr",
218217
"consider-using-dict-items",
219218
"consider-using-from-import",

src/_pytest/mark/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,10 @@ def from_markers(cls, markers: Iterable[Mark]) -> MarkMatcher:
237237
def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool:
238238
if not (matches := self.own_mark_name_mapping.get(name, [])):
239239
return False
240-
241-
for mark in matches:
242-
if all(mark.kwargs.get(k, NOT_SET) == v for k, v in kwargs.items()):
243-
return True
244-
245-
return False
240+
return any(
241+
all(mark.kwargs.get(k, NOT_SET) == v for (k, v) in kwargs.items())
242+
for mark in matches
243+
)
246244

247245

248246
def deselect_by_mark(items: list[Item], config: Config) -> None:

0 commit comments

Comments
 (0)