-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic formatting for ExprDict (#5167)
- Loading branch information
1 parent
dfb04e6
commit 773e79b
Showing
14 changed files
with
556 additions
and
170 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# before | ||
{ # open | ||
key# key | ||
: # colon | ||
value# value | ||
} # close | ||
# after | ||
|
||
|
||
{**d} | ||
|
||
{**a, # leading | ||
** # middle | ||
b # trailing | ||
} | ||
|
||
{ | ||
** # middle with single item | ||
b | ||
} | ||
|
||
{ | ||
# before | ||
** # between | ||
b, | ||
} | ||
|
||
{ | ||
**a # comment before preceeding node's comma | ||
, | ||
# before | ||
** # between | ||
b, | ||
} | ||
|
||
{} | ||
|
||
{1:2,} | ||
|
||
{1:2, | ||
3:4,} | ||
|
||
{asdfsadfalsdkjfhalsdkjfhalskdjfhlaksjdfhlaskjdfhlaskjdfhlaksdjfh: 1, adsfadsflasdflasdfasdfasdasdf: 2} | ||
|
||
mapping = { | ||
A: 0.25 * (10.0 / 12), | ||
B: 0.1 * (10.0 / 12), | ||
C: 0.1 * (10.0 / 12), | ||
D: 0.1 * (10.0 / 12), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 94 additions & 7 deletions
101
crates/ruff_python_formatter/src/expression/expr_dict.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.