-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add B041: Duplicate key-value pairs in dictionary literals (#496)
* b041 duplicate key in dictionary literal * only error if both keys and values are the same * format
- Loading branch information
1 parent
ea13615
commit 95f8791
Showing
4 changed files
with
87 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,24 @@ | ||
a = 1 | ||
test = {'yes': 1, 'yes': 1} | ||
test = {'yes': 1, 'yes': 1, 'no': 2, 'no': 2} | ||
test = {'yes': 1, 'yes': 1, 'yes': 1} | ||
test = {1: 1, 1.0: 1} | ||
test = {True: 1, True: 1} | ||
test = {None: 1, None: 1} | ||
test = {a: a, a: a} | ||
|
||
# no error if either keys or values are different | ||
test = {'yes': 1, 'yes': 2} | ||
test = {1: 1, 2: 1} | ||
test = {(0, 1): 1, (0, 2): 1} | ||
test = {(0, 1): 1, (0, 1): 2} | ||
b = 1 | ||
test = {a: a, b: a} | ||
test = {a: a, a: b} | ||
class TestClass: | ||
pass | ||
f = TestClass() | ||
f.a = 1 | ||
test = {f.a: 1, f.a: 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