Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve new flake8-bugbear errors (B020) #2950

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- Move test to disable plugin in Vim/Neovim, which speeds up loading (#2896)
- Resolve new flake8-bugbear errors (B020) (#2950)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can omit this since there's no effect on end users

JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved

### Output

Expand Down
6 changes: 3 additions & 3 deletions src/black/linegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,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