-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 (#3209)
- Loading branch information
1 parent
e7b9671
commit 4ebf14d
Showing
5 changed files
with
60 additions
and
2 deletions.
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
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