forked from psf/black
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip trailing commas in subscripts with -C
- Loading branch information
1 parent
507234c
commit 9de9cd2
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
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
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,34 @@ | ||
# We should not remove the trailing comma in a single-element subscript. | ||
a: tuple[int,] | ||
b = tuple[int,] | ||
|
||
# But commas in multiple element subscripts should be removed. | ||
c: tuple[int, int,] | ||
d = tuple[int, int,] | ||
|
||
# Remove commas for non-subscripts. | ||
small_list = [1,] | ||
list_of_types = [tuple[int,],] | ||
small_set = {1,} | ||
set_of_types = {tuple[int,],} | ||
|
||
# Except single element tuples | ||
small_tuple = (1,) | ||
|
||
# output | ||
# We should not remove the trailing comma in a single-element subscript. | ||
a: tuple[int,] | ||
b = tuple[int,] | ||
|
||
# But commas in multiple element subscripts should be removed. | ||
c: tuple[int, int] | ||
d = tuple[int, int] | ||
|
||
# Remove commas for non-subscripts. | ||
small_list = [1] | ||
list_of_types = [tuple[int,]] | ||
small_set = {1} | ||
set_of_types = {tuple[int,]} | ||
|
||
# Except single element tuples | ||
small_tuple = (1,) |
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