internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: psf/black

Issue:
Continuous integration: documentation generation failure due to mismatched reference function name
**Describe the bug**
As [spotted by @TBBle](https://github.com/psf/black/pull/1897#issuecomment-783193898), the 'build documentation' continuous integration step has been [failing with an `AttributeError`](https://github.com/psf/black/runs/1949719732#step:5:68); a mismatched function name in the reference documentation is the cause. 

**To Reproduce**
1. Observe the build output in continuous integration after commit afc8c326bf97ce7a22e8fc0b8cc5ced1586ef022 pending a fix (note that this currently only runs following documentation-related edits)

**Expected behavior**
1. The documentation build should succeed

**Environment (please complete the following information):**
Continuous Integration via GitHub Actions

**Does this bug also happen on master?** To answer this, you have two options:
Yes


Discussion:

Resolving patch:
diff --git a/src/black/__init__.py b/src/black/__init__.py
--- a/src/black/__init__.py
+++ b/src/black/__init__.py
@@ -1480,7 +1480,7 @@ class Line:
     comments: Dict[LeafID, List[Leaf]] = field(default_factory=dict)
     bracket_tracker: BracketTracker = field(default_factory=BracketTracker)
     inside_brackets: bool = False
-    should_split: bool = False
+    should_split_rhs: bool = False
     magic_trailing_comma: Optional[Leaf] = None
 
     def append(self, leaf: Leaf, preformatted: bool = False) -> None:
@@ -1792,7 +1792,7 @@ def clone(self) -> "Line":
             mode=self.mode,
             depth=self.depth,
             inside_brackets=self.inside_brackets,
-            should_split=self.should_split,
+            should_split_rhs=self.should_split_rhs,
             magic_trailing_comma=self.magic_trailing_comma,
         )
 
@@ -2712,7 +2712,7 @@ def init_st(ST: Type[StringTransformer]) -> StringTransformer:
     transformers: List[Transformer]
     if (
         not line.contains_uncollapsable_type_comments()
-        and not line.should_split
+        and not line.should_split_rhs
         and not line.magic_trailing_comma
         and (
             is_line_short_enough(line, line_length=mode.line_length, line_str=line_str)
@@ -4387,7 +4387,7 @@ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
             mode=line.mode,
             depth=line.depth + 1,
             inside_brackets=True,
-            should_split=line.should_split,
+            should_split_rhs=line.should_split_rhs,
             magic_trailing_comma=line.magic_trailing_comma,
         )
         string_leaf = Leaf(token.STRING, string_value)
@@ -5010,7 +5010,7 @@ def bracket_split_build_line(
         for comment_after in original.comments_after(leaf):
             result.append(comment_after, preformatted=True)
     if is_body and should_split_line(result, opening_bracket):
-        result.should_split = True
+        result.should_split_rhs = True
     return result
 
 


Test patch:
Repository: psf/black

Issue:
21.4b0 doesn't appear in docs changelog
**Describe the bug** 21.4b0 and corresponding changes are missing from https://black.readthedocs.io/en/stable/change_log.html

It seems there are two changelog files, out of sync

https://github.com/psf/black/blob/master/CHANGES.md
https://github.com/psf/black/blob/master/docs/change_log.md




Discussion:
@ichard26 - Can we delete the read the docs change log for now until you land your refactored docs please?
Sure, I can submit a PR 
Well the problem here is two fold:
1. the stable tag is still pointing to 20.8b1
2. `docs/change_log.md` is out of date with the authoritative `CHANGES.md`

The out of date problem doesn't show up on RTD since the generated copies are rebuilt during documentation building, but anyone reading on GitHub will get outdated versions.

I guess deleting the generated changelog isn't too bad of a stopgap anyway.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -219,7 +219,6 @@ def process_sections(
     DocSection("blackd", CURRENT_DIR / "blackd.md"),
     DocSection("black_primer", CURRENT_DIR / "black_primer.md"),
     DocSection("contributing_to_black", CURRENT_DIR / ".." / "CONTRIBUTING.md"),
-    DocSection("change_log", CURRENT_DIR / ".." / "CHANGES.md"),
 ]
 
 # Sphinx complains when there is a source file that isn't referenced in any of the docs.
@@ -231,6 +230,7 @@ def process_sections(
     "pragmatism",
     "testimonials",
     "used_by",
+    "change_log",
 }
 
 make_pypi_svg(release)


Test patch:
Repository: psf/black

Issue:
False-alarm in `RELAXED_DECORATORS` detection breaks compatibility with Python < 3.9 
Running Black 21.4b2 on the following code:

```python
@get_decorator()
def f():
    return u"This should be Unicode on Python 2"
```

incorrectly strips the `u`-prefix from the string, because the minimum Python version is incorrectly detected as 3.9 (via a false detection of relaxed decorator syntax).  Removing the `()` in `@get_decorator()` avoids this problem.

I'm pretty sure that the solution is to fix [`black.is_simple_decorator_expression()`](https://github.com/psf/black/blob/35e8d1560d68e8113ff926a9f832582f8f4a694f/src/black/__init__.py#L5775-L5796).


Discussion:

Resolving patch:
diff --git a/src/black/__init__.py b/src/black/__init__.py
--- a/src/black/__init__.py
+++ b/src/black/__init__.py
@@ -5761,6 +5761,13 @@ def is_simple_decorator_trailer(node: LN, last: bool = False) -> bool:
             and node.children[0].type == token.DOT
             and node.children[1].type == token.NAME
         )
+        # last trailer can be an argument-less parentheses pair
+        or (
+            last
+            and len(node.children) == 2
+            and node.children[0].type == token.LPAR
+            and node.children[1].type == token.RPAR
+        )
         # last trailer can be arguments
         or (
             last


Test patch:
diff --git a/tests/data/decorators.py b/tests/data/decorators.py
--- a/tests/data/decorators.py
+++ b/tests/data/decorators.py
@@ -13,6 +13,12 @@ def f():
 
 ##
 
+@decorator()
+def f():
+    ...
+
+##
+
 @decorator(arg)
 def f():
     ...
Repository: psf/black

Issue:
experimental string processing crash on very long variable name
On main with `--experimental-string-processing`:

```
% cat espcrash.py 
xxxxxx_xxx_xxxx_xx_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxx_xxxx_xxxxx = xxxx.xxxxxx.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxx(
    xx_xxxxxx={
        "x3_xxxxxxxx": f"{x3_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxxxxxx_xxxxxx}_xxxxxxx",
    },
)
% black --experimental-string-processing espcrash.py         
error: cannot format espcrash.py: INTERNAL ERROR: hand-made leaf without parent: Leaf(STRING, '"x3_xxxxxxxx"')
Oh no! 💥 💔 💥
1 file failed to reformat.
```

cc @bbugyi200 


Discussion:

Resolving patch:
diff --git a/src/black/linegen.py b/src/black/linegen.py
--- a/src/black/linegen.py
+++ b/src/black/linegen.py
@@ -961,14 +961,19 @@ def run_transformer(
 
         result.extend(transform_line(transformed_line, mode=mode, features=features))
 
-    if not (
-        transform.__name__ == "rhs"
-        and line.bracket_tracker.invisible
-        and not any(bracket.value for bracket in line.bracket_tracker.invisible)
-        and not line.contains_multiline_strings()
-        and not result[0].contains_uncollapsable_type_comments()
-        and not result[0].contains_unsplittable_type_ignore()
-        and not is_line_short_enough(result[0], line_length=mode.line_length)
+    if (
+        transform.__name__ != "rhs"
+        or not line.bracket_tracker.invisible
+        or any(bracket.value for bracket in line.bracket_tracker.invisible)
+        or line.contains_multiline_strings()
+        or result[0].contains_uncollapsable_type_comments()
+        or result[0].contains_unsplittable_type_ignore()
+        or is_line_short_enough(result[0], line_length=mode.line_length)
+        # If any leaves have no parents (which _can_ occur since
+        # `transform(line)` potentially destroys the line's underlying node
+        # structure), then we can't proceed. Doing so would cause the below
+        # call to `append_leaves()` to fail.
+        or any(leaf.parent is None for leaf in line.leaves)
     ):
         return result
 


Test patch:
diff --git a/tests/data/long_strings__regression.py b/tests/data/long_strings__regression.py
--- a/tests/data/long_strings__regression.py
+++ b/tests/data/long_strings__regression.py
@@ -518,6 +518,12 @@ async def foo(self):
     "\N{BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR}\N{VARIATION SELECTOR-16}"
 )
 
+xxxxxx_xxx_xxxx_xx_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxx_xxxx_xxxxx = xxxx.xxxxxx.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxx(
+    xx_xxxxxx={
+        "x3_xxxxxxxx": "xxx3_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxxxxxx_xxxxxx_xxxxxxx",
+    },
+)
+
 
 # output
 
@@ -1150,3 +1156,11 @@ async def foo(self):
 x = (
     "\N{BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR}\N{VARIATION SELECTOR-16}"
 )
+
+xxxxxx_xxx_xxxx_xx_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxx_xxxx_xxxxx = xxxx.xxxxxx.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxx(
+    xx_xxxxxx={
+        "x3_xxxxxxxx": (
+            "xxx3_xxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxx_xxxxxxxx_xxxxxx_xxxxxxx"
+        ),
+    },
+)
Repository: psf/black

Issue:
Failing to parse single-quote f-string with backslash inside it
**Describe the bug**

The formatter is failing to parse single quote f-string as it cannot include a backslash inside it.

**To Reproduce**

1. Take this test.py containing:
```python
b = "example1"
sts = "example2"
f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n"
```
2. Run black without arguments.
3. See error -->
```
  File "/var/task/black/__init__.py", line 986, in assert_equivalent
    dst_ast = parse_ast(dst)
  File "/var/task/black/parsing.py", line 125, in parse_ast
    raise SyntaxError(
f'"{b}"{\' \' * (long-len(b)+1)}: "{sts}",\n'
```

**Expected behavior**
The formatter is expected to throw the said error and fail to format the said file.

**Environment (please complete the following information):**

- Version: [main]
- OS and Python version: [Linux/Python 3.9.5]

**Does this bug also happen on main?**
Yes



Discussion:

Resolving patch:
diff --git a/src/black/strings.py b/src/black/strings.py
--- a/src/black/strings.py
+++ b/src/black/strings.py
@@ -190,9 +190,9 @@ def normalize_string_quotes(s: str) -> str:
     if "f" in prefix.casefold():
         matches = re.findall(
             r"""
-            (?:[^{]|^)\{  # start of the string or a non-{ followed by a single {
+            (?:(?<!\{)|^)\{  # start of the string or a non-{ followed by a single {
                 ([^{].*?)  # contents of the brackets except if begins with {{
-            \}(?:[^}]|$)  # A } followed by end of the string or a non-}
+            \}(?:(?!\})|$)  # A } followed by end of the string or a non-}
             """,
             new_body,
             re.VERBOSE,


Test patch:
diff --git a/tests/data/string_quotes.py b/tests/data/string_quotes.py
--- a/tests/data/string_quotes.py
+++ b/tests/data/string_quotes.py
@@ -51,6 +51,11 @@
 '\'{z}\' {y * " "}'
 '{y * x} \'{z}\''
 
+# We must bail out if changing the quotes would introduce backslashes in f-string
+# expressions. xref: https://github.com/psf/black/issues/2348
+f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n"
+f"\"{a}\"{'hello' * b}\"{c}\""
+
 # output
 
 """"""
@@ -100,3 +105,8 @@
 f"{y * x} '{z}'"
 "'{z}' {y * \" \"}"
 "{y * x} '{z}'"
+
+# We must bail out if changing the quotes would introduce backslashes in f-string
+# expressions. xref: https://github.com/psf/black/issues/2348
+f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n"
+f"\"{a}\"{'hello' * b}\"{c}\""
Repository: psf/black

Issue:
match/case statements containing those soft-keywords gets wrongly separated
The following input;
```py

match match:
    case case:
        pass
```

Will be formatted as

```py

match
match:
    case
    case:
        pass
```

which is unfortunately invalid. Though the good thing is that, the parser works but apparently I choose to wrong visitor method on the initial implementation. So we need a separate one to handle soft-keywords better.


Discussion:

Resolving patch:
diff --git a/src/black/linegen.py b/src/black/linegen.py
--- a/src/black/linegen.py
+++ b/src/black/linegen.py
@@ -127,7 +127,7 @@ def visit_stmt(
         """Visit a statement.
 
         This implementation is shared for `if`, `while`, `for`, `try`, `except`,
-        `def`, `with`, `class`, `assert`, `match`, `case` and assignments.
+        `def`, `with`, `class`, `assert`, and assignments.
 
         The relevant Python language `keywords` for a given statement will be
         NAME leaves within it. This methods puts those on a separate line.
@@ -142,6 +142,14 @@ def visit_stmt(
 
             yield from self.visit(child)
 
+    def visit_match_case(self, node: Node) -> Iterator[Line]:
+        """Visit either a match or case statement."""
+        normalize_invisible_parens(node, parens_after=set())
+
+        yield from self.line()
+        for child in node.children:
+            yield from self.visit(child)
+
     def visit_suite(self, node: Node) -> Iterator[Line]:
         """Visit a suite."""
         if self.mode.is_pyi and is_stub_suite(node):
@@ -294,8 +302,8 @@ def __post_init__(self) -> None:
         self.visit_decorated = self.visit_decorators
 
         # PEP 634
-        self.visit_match_stmt = partial(v, keywords={"match"}, parens=Ø)
-        self.visit_case_block = partial(v, keywords={"case"}, parens=Ø)
+        self.visit_match_stmt = self.visit_match_case
+        self.visit_case_block = self.visit_match_case
 
 
 def transform_line(


Test patch:
diff --git a/tests/data/pattern_matching_extras.py b/tests/data/pattern_matching_extras.py
--- a/tests/data/pattern_matching_extras.py
+++ b/tests/data/pattern_matching_extras.py
@@ -23,10 +23,10 @@
 
 def func(match: case, case: match) -> case:
     match Something():
-        case another:
-            ...
         case func(match, case):
             ...
+        case another:
+            ...
 
 
 match maybe, multiple:
@@ -47,6 +47,33 @@ def func(match: case, case: match) -> case:
 
 match a, *b, c:
     case [*_]:
-        return "seq"
+        assert "seq" == _
     case {}:
-        return "map"
+        assert "map" == b
+
+
+match match(
+    case,
+    match(
+        match, case, match, looooooooooooooooooooooooooooooooooooong, match, case, match
+    ),
+    case,
+):
+    case case(
+        match=case,
+        case=re.match(
+            loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
+        ),
+    ):
+        pass
+
+    case [a as match]:
+        pass
+
+    case case:
+        pass
+
+
+match match:
+    case case:
+        pass
Repository: psf/black

Issue:
py310 match: one-line case breaks
**Describe the bug**
In `python3.10` the `case` black can be written in the same line as the `case` keyword. However, this breaks `black`.

**To Reproduce**
Take this example code
```python
# example.py
x = 5
match x:
    case 5: print("it works")
```
It runs under `python3.10`:
```sh
python example.py
it works
```
However, `black` crashes:
```
black --target-version py310 example.py
error: cannot format example.py: INTERNAL ERROR: Black produced invalid code on pass 1: expected an indented block after 'case' statement on line 3 (<unknown>, line 4). Please report a bug on https://github.com/psf/black/issues.  This invalid output might be helpful: /var/folders/cz/v1lxwy5579502ksd81z14_t40000gp/T/blk_inxhkvdg.log
Oh no! 💥 💔 💥
1 file failed to reformat.
```
After manually reformatting the example as follows
```python
x = 5
match x:
    case 5:
        print("it works")
```
`black` stops crashing.

**Expected behavior**
`black` should not crash.

**Environment**
* macOS Big Sur 11.6
* `python 3.10.0`
* `black --version`: `black, 21.11b1 (compiled: no)`


Discussion:
Confirmed the crash. cc @isidentical 

This is the output black produces (from the log file):
```
x = 5
match x:
    case 5:
    print("it works")
```
Will send a patch tonight, thanks for the report.

Resolving patch:
diff --git a/src/black/nodes.py b/src/black/nodes.py
--- a/src/black/nodes.py
+++ b/src/black/nodes.py
@@ -52,6 +52,8 @@
     syms.with_stmt,
     syms.funcdef,
     syms.classdef,
+    syms.match_stmt,
+    syms.case_block,
 }
 STANDALONE_COMMENT: Final = 153
 token.tok_name[STANDALONE_COMMENT] = "STANDALONE_COMMENT"


Test patch:
diff --git a/tests/data/pattern_matching_style.py b/tests/data/pattern_matching_style.py
new file mode 100644
--- /dev/null
+++ b/tests/data/pattern_matching_style.py
@@ -0,0 +1,27 @@
+match something:
+    case b(): print(1+1)
+    case c(
+        very_complex=True,
+        perhaps_even_loooooooooooooooooooooooooooooooooooooong=-   1
+    ): print(1)
+    case c(
+        very_complex=True,
+        perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
+    ): print(2)
+    case a: pass
+
+# output
+
+match something:
+    case b():
+        print(1 + 1)
+    case c(
+        very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
+    ):
+        print(1)
+    case c(
+        very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
+    ):
+        print(2)
+    case a:
+        pass
diff --git a/tests/test_format.py b/tests/test_format.py
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -74,6 +74,7 @@
     "pattern_matching_simple",
     "pattern_matching_complex",
     "pattern_matching_extras",
+    "pattern_matching_style",
     "parenthesized_context_managers",
 ]
Repository: psf/black

Issue:
Black unnecessarily separating star from the expression on match statement
Input:
```py
match a, *b(), c:
    case d, *f, g:
        pass
```

Expected:
```py
match a, *b(), c:
    case d, *f, g:
        pass
```

Got:
```py
match a, * b(), c:
    case d, *f, g:
        pass
```


Discussion:

Resolving patch:
diff --git a/src/black/nodes.py b/src/black/nodes.py
--- a/src/black/nodes.py
+++ b/src/black/nodes.py
@@ -97,6 +97,8 @@
     syms.listmaker,
     syms.testlist_gexp,
     syms.testlist_star_expr,
+    syms.subject_expr,
+    syms.pattern,
 }
 TEST_DESCENDANTS: Final = {
     syms.test,


Test patch:
diff --git a/tests/data/pattern_matching_extras.py b/tests/data/pattern_matching_extras.py
--- a/tests/data/pattern_matching_extras.py
+++ b/tests/data/pattern_matching_extras.py
@@ -77,3 +77,8 @@ def func(match: case, case: match) -> case:
 match match:
     case case:
         pass
+
+
+match a, *b(), c:
+    case d, *f, g:
+        pass
Repository: psf/black

Issue:
Bug on regular expression with black-21.12b0
<!--
Please make sure that the bug is not already fixed either in newer versions or the
current development version. To confirm this, you have three options:

1. Update Black's version if a newer release exists: `pip install -U black`
2. Use the online formatter at <https://black.vercel.app/?version=main>, which will use
   the latest main branch.
3. Or run _Black_ on your machine:
   - create a new virtualenv (make sure it's the same Python version);
   - clone this repository;
   - run `pip install -e .[d,python2]`;
   - run `pip install -r test_requirements.txt`
   - make sure it's sane by running `python -m pytest`; and
   - run `black` like you did last time.
-->

**Describe the bug**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce**

<!--
Minimal steps to reproduce the behavior with source code and Black's configuration.
-->

With `pyproject.toml`

```
[tool.black]
line-length = 88
target-version = ['py36', 'py37', 'py38']
exclude = '''
/(
    \.eggs
  | \.git
  | \.mypy_cache
  | \.tox
  | \.env.*
  | \env
  | \.venv
  | \.venv2
  | venv
  | venv2
  | _build
  | build
  | dist
  | examples
  | docs

)/
'''

```

And run it with these arguments:

```sh
$ black --config="pyproject.toml" .
```

The resulting error is:

> Error: Invalid value for '--exclude': Not a valid regular expression


**Environment**

<!-- Please complete the following information: -->

- Black's version:  21.12b0
- OS and Python version: macOs BigSur Python 3.8.10

**Additional context**

No problem with previous versions.



Discussion:
The last line should be `\)`, not `)\`.
FWIW, unless I'm missing something, we use something similar [with our configuration](https://github.com/psf/black/blob/main/pyproject.toml) and it doesn't break 🤷 Is that initial boolean OR really making and breaking this regex?
Sorry, I was wrong. The problem is actually the `  | \env` line. I don't know what you meant but presumably it should be `\.env` or `env`. I can submit a PR so the error message doesn't drop re's error:
```
Error: Invalid value for '--exclude': Not a valid regular expression: bad escape \e at position 71 (line 7, column 5)
```
Ah, I did miss that :( good catch

Resolving patch:
diff --git a/src/black/__init__.py b/src/black/__init__.py
--- a/src/black/__init__.py
+++ b/src/black/__init__.py
@@ -177,8 +177,8 @@ def validate_regex(
 ) -> Optional[Pattern[str]]:
     try:
         return re_compile_maybe_verbose(value) if value is not None else None
-    except re.error:
-        raise click.BadParameter("Not a valid regular expression") from None
+    except re.error as e:
+        raise click.BadParameter(f"Not a valid regular expression: {e}") from None
 
 
 @click.command(


Test patch:
Repository: psf/black

Issue:
Backtracking parser does not ignore newlines/comments
The regular parser ignores `token.NL`/`token.COMMENT` since the grammar assumes there can be any number of them during parsing. This is actually handled in the driver rather than parser, so when the parser got implemented initially we did not specifically instruct this. But seems like it is now needed.

https://github.com/pantsbuild/pants/blob/aa1d38d4f3b791509bff773a65c2b07490bacad3/src/python/pants/util/enums_test.py#L33-L41

This seem to only cover cases where a standalone `match` or `case` is used in a newline fashion:
```py
match(
     something
)
```

It does not include `re.match()` or other variants as far as I can see. The fix is should be really easy, just ignoring those tokens on the recorder.


Discussion:

Resolving patch:
diff --git a/src/blib2to3/pgen2/parse.py b/src/blib2to3/pgen2/parse.py
--- a/src/blib2to3/pgen2/parse.py
+++ b/src/blib2to3/pgen2/parse.py
@@ -269,6 +269,10 @@ def addtoken(self, type: int, value: Text, context: Context) -> bool:
                     break
 
                 next_token_type, next_token_value, *_ = proxy.eat(counter)
+                if next_token_type in (tokenize.COMMENT, tokenize.NL):
+                    counter += 1
+                    continue
+
                 if next_token_type == tokenize.OP:
                     next_token_type = grammar.opmap[next_token_value]
 


Test patch:
diff --git a/tests/data/pattern_matching_style.py b/tests/data/pattern_matching_style.py
--- a/tests/data/pattern_matching_style.py
+++ b/tests/data/pattern_matching_style.py
@@ -6,10 +6,52 @@
     ): print(1)
     case c(
         very_complex=True,
-        perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
+        perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1,
     ): print(2)
     case a: pass
 
+match(
+    arg # comment
+)
+
+match(
+)
+
+match(
+
+
+)
+
+case(
+    arg # comment
+)
+
+case(
+)
+
+case(
+
+
+)
+
+
+re.match(
+    something # fast
+)
+re.match(
+
+
+
+)
+match match(
+
+
+):
+    case case(
+        arg, # comment
+    ):
+        pass
+
 # output
 
 match something:
@@ -20,8 +62,30 @@
     ):
         print(1)
     case c(
-        very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
+        very_complex=True,
+        perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1,
     ):
         print(2)
     case a:
         pass
+
+match(arg)  # comment
+
+match()
+
+match()
+
+case(arg)  # comment
+
+case()
+
+case()
+
+
+re.match(something)  # fast
+re.match()
+match match():
+    case case(
+        arg,  # comment
+    ):
+        pass