mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
Format PatternMatchClass
(#6860)
This commit is contained in:
parent
91880b8273
commit
91a780c771
10 changed files with 458 additions and 536 deletions
|
@ -264,6 +264,7 @@ match foo:
|
|||
y = 1
|
||||
|
||||
|
||||
|
||||
match foo:
|
||||
case [1, 2, *rest]:
|
||||
pass
|
||||
|
@ -399,3 +400,61 @@ match foo:
|
|||
b,
|
||||
}:
|
||||
pass
|
||||
|
||||
|
||||
match pattern_match_class:
|
||||
case Point2D(
|
||||
# own line
|
||||
):
|
||||
...
|
||||
|
||||
case (
|
||||
Point2D
|
||||
# own line
|
||||
()
|
||||
):
|
||||
...
|
||||
|
||||
case Point2D( # end of line line
|
||||
):
|
||||
...
|
||||
|
||||
case Point2D( # end of line
|
||||
0, 0
|
||||
):
|
||||
...
|
||||
|
||||
case Point2D(0, 0):
|
||||
...
|
||||
|
||||
case Point2D(
|
||||
( # end of line
|
||||
# own line
|
||||
0
|
||||
), 0):
|
||||
...
|
||||
|
||||
case Point3D(x=0, y=0, z=000000000000000000000000000000000000000000000000000000000000000000000000000000000):
|
||||
...
|
||||
|
||||
case Bar(0, a=None, b="hello"):
|
||||
...
|
||||
|
||||
case FooBar(# leading
|
||||
# leading
|
||||
# leading
|
||||
# leading
|
||||
0 # trailing
|
||||
# trailing
|
||||
# trailing
|
||||
# trailing
|
||||
):
|
||||
...
|
||||
|
||||
case A(
|
||||
b # b
|
||||
= # c
|
||||
2 # d
|
||||
# e
|
||||
):
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue