Skip to content

Commit 7aa1f08

Browse files
[refactor] Use a generator for '_has_variadic_argument' (#6770)
1 parent 4295d41 commit 7aa1f08

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

pylint/checkers/base/basic_checker.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,12 @@ def _filter_vararg(
419419
def _has_variadic_argument(
420420
args: list[nodes.Starred | nodes.Keyword], variadic_name: str
421421
) -> bool:
422-
if not args:
423-
return True
424-
for arg in args:
425-
if isinstance(arg.value, nodes.Name):
426-
if arg.value.name != variadic_name:
427-
return True
428-
else:
429-
return True
430-
return False
422+
return not args or any(
423+
isinstance(a.value, nodes.Name)
424+
and a.value.name != variadic_name
425+
or not isinstance(a.value, nodes.Name)
426+
for a in args
427+
)
431428

432429
@utils.only_required_for_messages("unnecessary-lambda")
433430
def visit_lambda(self, node: nodes.Lambda) -> None:

0 commit comments

Comments
 (0)