mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-09 18:02:19 +00:00
format StmtTryStar (#5418)
This commit is contained in:
parent
a973019358
commit
ca5e10b5ea
5 changed files with 205 additions and 23 deletions
|
@ -76,6 +76,25 @@ try:
|
|||
except:
|
||||
a = 10 # trailing comment1
|
||||
b = 11 # trailing comment2
|
||||
|
||||
|
||||
# try/except*, mostly the same as try
|
||||
try: # try
|
||||
...
|
||||
# end of body
|
||||
# before except
|
||||
except* (Exception, ValueError) as exc: # except line
|
||||
...
|
||||
# before except 2
|
||||
except* KeyError as key: # except line 2
|
||||
...
|
||||
# in body 2
|
||||
# before else
|
||||
else:
|
||||
...
|
||||
# before finally
|
||||
finally:
|
||||
...
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -161,6 +180,26 @@ try:
|
|||
except:
|
||||
a = 10 # trailing comment1
|
||||
b = 11 # trailing comment2
|
||||
|
||||
|
||||
# try/except*, mostly the same as try
|
||||
try:
|
||||
# try
|
||||
...
|
||||
# end of body
|
||||
# before except
|
||||
except* (Exception, ValueError) as exc: # except line
|
||||
...
|
||||
# before except 2
|
||||
except* KeyError as key: # except line 2
|
||||
...
|
||||
# in body 2
|
||||
# before else
|
||||
else:
|
||||
...
|
||||
# before finally
|
||||
finally:
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue