Skip to content

Commit

Permalink
Issue adamchainz#503 - change rule for useless generator pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Karine-Bauch committed Jul 30, 2023
1 parent b97b726 commit c12724e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/flake8_comprehensions/__init__.py
Expand Up @@ -201,17 +201,17 @@ def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]:
)

elif (
num_positional_args == 1
and node.func.id == "print"
and isinstance(node.args[0], ast.Call)
and isinstance(node.args[0].func, ast.Name)
and node.args[0].func.id == "sorted"
and isinstance(node.args[0].args[0], ast.GeneratorExp)
node.func.id == "sorted"
and num_positional_args > 0
and (
isinstance(node.args[0], ast.GeneratorExp)
and isinstance(node.args[0].elt, ast.Name)
)
):
yield (
node.lineno,
node.col_offset,
self.messages["C412"],
self.messages["C420"],
type(self),
)

Expand Down

0 comments on commit c12724e

Please sign in to comment.