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

Fix incorrect space before colon in if/while stmts #1655

Merged
merged 2 commits into from Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/black/__init__.py
Expand Up @@ -5190,9 +5190,9 @@ def normalize_invisible_parens(node: Node, parens_after: Set[str]) -> None:

if check_lpar:
if is_walrus_assignment(child):
continue
pass

if child.type == syms.atom:
elif child.type == syms.atom:
if maybe_make_parens_invisible_in_atom(child, parent=node):
wrap_in_parentheses(node, child, visible=False)
elif is_one_tuple(child):
Expand Down
4 changes: 4 additions & 0 deletions tests/data/pep_572.py
Expand Up @@ -2,6 +2,8 @@
(a := a)
if (match := pattern.search(data)) is None:
pass
if (match := pattern.search(data)):
pass
[y := f(x), y ** 2, y ** 3]
filtered_data = [y for x in data if (y := f(x)) is None]
(y := f(x))
Expand Down Expand Up @@ -41,3 +43,5 @@ def foo(answer: (p := 42) = 5):

while x := f(x):
pass
while (x := f(x)):
pass