Skip to content

Preview style removes comment in with block #3408

@JelleZijlstra

Description

@JelleZijlstra
% cat eatcomment.py 
if False:
    with xxxxxxxxxx(
        "mypy",  # mypy-c doesn't support __package__
        "py.typed",  # a marker file for type information, we assume typeshed to live in the same dir
    ) as xxxxx:
        pass
% black --diff --preview eatcomment.py
--- eatcomment.py	2022-12-09 02:39:37.001919 +0000
+++ eatcomment.py	2022-12-09 02:40:57.322777 +0000
@@ -1,6 +1,3 @@
 if False:
-    with xxxxxxxxxx(
-        "mypy",  # mypy-c doesn't support __package__
-        "py.typed",  # a marker file for type information, we assume typeshed to live in the same dir
-    ) as xxxxx:
+    with xxxxxxxxxx("mypy", "py.typed") as xxxxx:  # mypy-c doesn't support __package__
         pass
would reformat eatcomment.py

All done! ✨ 🍰 ✨
1 file would be reformatted.

Running black 22.10.0. Isolated from some code in mypy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions