mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Prefer preserving WithItem
parentheses (#7694)
This commit is contained in:
parent
1e173f7909
commit
f53c410ff8
3 changed files with 83 additions and 4 deletions
|
@ -294,6 +294,25 @@ with (
|
|||
|
||||
with (foo() as bar, baz() as bop):
|
||||
pass
|
||||
|
||||
if True:
|
||||
with (
|
||||
anyio.CancelScope(shield=True)
|
||||
if get_running_loop()
|
||||
else contextlib.nullcontext()
|
||||
):
|
||||
pass
|
||||
|
||||
if True:
|
||||
with (
|
||||
anyio.CancelScope(shield=True)
|
||||
and B and [aaaaaaaa, bbbbbbbbbbbbb, cccccccccc, dddddddddddd, eeeeeeeeeeeee]
|
||||
):
|
||||
pass
|
||||
|
||||
if True:
|
||||
with anyio.CancelScope(shield=True) if get_running_loop() else contextlib.nullcontext():
|
||||
pass
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -580,13 +599,17 @@ with f(
|
|||
) as b, c as d:
|
||||
pass
|
||||
|
||||
with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b:
|
||||
with (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) as b:
|
||||
pass
|
||||
|
||||
with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b:
|
||||
pass
|
||||
|
||||
with aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b, c as d:
|
||||
with (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) as b, c as d:
|
||||
pass
|
||||
|
||||
with (
|
||||
|
@ -605,6 +628,28 @@ with (
|
|||
|
||||
with foo() as bar, baz() as bop:
|
||||
pass
|
||||
|
||||
if True:
|
||||
with (
|
||||
anyio.CancelScope(shield=True)
|
||||
if get_running_loop()
|
||||
else contextlib.nullcontext()
|
||||
):
|
||||
pass
|
||||
|
||||
if True:
|
||||
with (
|
||||
anyio.CancelScope(shield=True)
|
||||
and B
|
||||
and [aaaaaaaa, bbbbbbbbbbbbb, cccccccccc, dddddddddddd, eeeeeeeeeeeee]
|
||||
):
|
||||
pass
|
||||
|
||||
if True:
|
||||
with anyio.CancelScope(
|
||||
shield=True
|
||||
) if get_running_loop() else contextlib.nullcontext():
|
||||
pass
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue