Preserve parentheses around partial call chains (#7109)

This commit is contained in:
Charlie Marsh 2023-09-04 10:57:04 +01:00 committed by GitHub
parent 7be28a38c5
commit ece30e7c69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 207 additions and 38 deletions

View file

@ -167,6 +167,61 @@ max_message_id = (
max_message_id = (
Message.objects.filter(recipient=recipient).order_by("id").reverse()[0].id()
)
# Parentheses with fluent style within and outside of the parentheses.
(
(
df1_aaaaaaaaaaaa.merge()
)
.groupby(1,)
.sum()
)
(
( # foo
df1_aaaaaaaaaaaa.merge()
)
.groupby(1,)
.sum()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(1,)
)
.sum()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(1,)
)
.sum()
.bar()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(1,)
.bar()
)
.sum()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(1,)
.bar()
)
.sum()
.baz()
)
```
## Output
@ -350,6 +405,66 @@ max_message_id = (
max_message_id = (
Message.objects.filter(recipient=recipient).order_by("id").reverse()[0].id()
)
# Parentheses with fluent style within and outside of the parentheses.
(
(df1_aaaaaaaaaaaa.merge())
.groupby(
1,
)
.sum()
)
(
( # foo
df1_aaaaaaaaaaaa.merge()
)
.groupby(
1,
)
.sum()
)
(
(
df1_aaaaaaaaaaaa.merge().groupby(
1,
)
).sum()
)
(
(
df1_aaaaaaaaaaaa.merge().groupby(
1,
)
)
.sum()
.bar()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(
1,
)
.bar()
).sum()
)
(
(
df1_aaaaaaaaaaaa.merge()
.groupby(
1,
)
.bar()
)
.sum()
.baz()
)
```