Skip to content

Commit

Permalink
Resolve new flake8-bugbear errors (B020) (GH-2950)
Browse files Browse the repository at this point in the history
Fixes a couple places where we were using the same variable name as we
are iterating over.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
  • Loading branch information
jpy-git and JelleZijlstra committed Mar 24, 2022
1 parent 14e5ce5 commit 14d84ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/black/linegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ def dont_increase_indentation(split_func: Transformer) -> Transformer:

@wraps(split_func)
def split_wrapper(line: Line, features: Collection[Feature] = ()) -> Iterator[Line]:
for line in split_func(line, features):
normalize_prefix(line.leaves[0], inside_brackets=True)
yield line
for split_line in split_func(line, features):
normalize_prefix(split_line.leaves[0], inside_brackets=True)
yield split_line

return split_wrapper

Expand Down
4 changes: 2 additions & 2 deletions src/black/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def stringify_ast(node: Union[ast.AST, ast3.AST], depth: int = 0) -> Iterator[st
and isinstance(node, (ast.Delete, ast3.Delete))
and isinstance(item, (ast.Tuple, ast3.Tuple))
):
for item in item.elts:
yield from stringify_ast(item, depth + 2)
for elt in item.elts:
yield from stringify_ast(elt, depth + 2)

elif isinstance(item, (ast.AST, ast3.AST)):
yield from stringify_ast(item, depth + 2)
Expand Down

0 comments on commit 14d84ba

Please sign in to comment.