Skip to content

Commit

Permalink
Automatically remove duplicate dictionary keys
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 7, 2023
1 parent 8c836ae commit e972880
Show file tree
Hide file tree
Showing 12 changed files with 1,366 additions and 75 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ For more, see [Pyflakes](https://pypi.org/project/pyflakes/2.5.0/) on PyPI.
| F524 | StringDotFormatMissingArguments | '...'.format(...) is missing argument(s) for placeholder(s): ... | |
| F525 | StringDotFormatMixingAutomatic | '...'.format(...) mixes automatic and manual numbering | |
| F541 | FStringMissingPlaceholders | f-string without any placeholders | 🛠 |
| F601 | MultiValueRepeatedKeyLiteral | Dictionary key literal repeated | |
| F602 | MultiValueRepeatedKeyVariable | Dictionary key `...` repeated | |
| F601 | MultiValueRepeatedKeyLiteral | Dictionary key literal `...` repeated | 🛠 |
| F602 | MultiValueRepeatedKeyVariable | Dictionary key `...` repeated | 🛠 |
| F621 | ExpressionsInStarAssignment | Too many expressions in star-unpacking assignment | |
| F622 | TwoStarredExpressions | Two starred expressions in assignment | |
| F631 | AssertTuple | Assert test is a non-empty tuple, which is always `True` | |
Expand Down
37 changes: 37 additions & 0 deletions resources/test/fixtures/pyflakes/F601.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,40 @@
b"123": 1,
b"123": 4,
}

x = {
"a": 1,
"a": 2,
"a": 3,
"a": 3,
}

x = {
"a": 1,
"a": 2,
"a": 3,
"a": 3,
"a": 4,
}

x = {
"a": 1,
"a": 1,
"a": 2,
"a": 3,
"a": 4,
}

x = {
a: 1,
"a": 1,
a: 1,
"a": 2,
a: 2,
"a": 3,
a: 3,
"a": 3,
a: 4,
}

x = {"b": 2, "a": 1, "b": 2}
37 changes: 37 additions & 0 deletions resources/test/fixtures/pyflakes/F602.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,40 @@
a: 2,
b: 3,
}

x = {
a: 1,
a: 2,
a: 3,
a: 3,
}

x = {
a: 1,
a: 2,
a: 3,
a: 3,
a: 4,
}

x = {
a: 1,
a: 1,
a: 2,
a: 3,
a: 4,
}

x = {
a: 1,
"a": 1,
a: 1,
"a": 2,
a: 2,
"a": 3,
a: 3,
"a": 3,
a: 4,
}

x = {b: 2, a: 1, b: 2}
Loading

0 comments on commit e972880

Please sign in to comment.