]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Resolve new flake8-bugbear errors (B020) (GH-2950)
authorJoe Young <80432516+jpy-git@users.noreply.github.com>
Thu, 24 Mar 2022 15:14:21 +0000 (15:14 +0000)
committerGitHub <noreply@github.com>
Thu, 24 Mar 2022 15:14:21 +0000 (11:14 -0400)
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>
src/black/linegen.py
src/black/parsing.py

index cb605ee8be484e1e9db4f004d45444a776753a18..9c85e76d3e881c2a6afeda30285477a868d56a7a 100644 (file)
@@ -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]:
 
     @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
 
 
     return split_wrapper
 
index db48ae4baf5cf181b7647609603c6f75d6b2d523..1272656794873ec67696bd1fbc40d4364ea76bdf 100644 (file)
@@ -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))
                 ):
                     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)
 
                 elif isinstance(item, (ast.AST, ast3.AST)):
                     yield from stringify_ast(item, depth + 2)