-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ruff rule F601 - Dictionary key literal 'use_composition'
repeated
#4293
Merged
Conversation
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
% `ruff check` ``` Error: nav2_system_tests/src/system/test_wrong_init_pose_launch.py:117:21: F601 Dictionary key literal `'use_composition'` repeated ``` % ` ruff rule F601` # multi-value-repeated-key-literal (F601) Derived from the **Pyflakes** linter. Fix is sometimes available. ## What it does Checks for dictionary literals that associate multiple values with the same key. ## Why is this bad? Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake. ## Example ```python foo = { "bar": 1, "baz": 2, "baz": 3, } foo["baz"] # 3 ``` Use instead: ```python foo = { "bar": 1, "baz": 2, } foo["baz"] # 2 ``` ## References - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) Signed-off-by: Christian Clauss <[email protected]>
SteveMacenski
approved these changes
May 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :-)
enricosutera
pushed a commit
to enricosutera/navigation2
that referenced
this pull request
May 19, 2024
…os-navigation#4293) % `ruff check` ``` Error: nav2_system_tests/src/system/test_wrong_init_pose_launch.py:117:21: F601 Dictionary key literal `'use_composition'` repeated ``` % ` ruff rule F601` # multi-value-repeated-key-literal (F601) Derived from the **Pyflakes** linter. Fix is sometimes available. ## What it does Checks for dictionary literals that associate multiple values with the same key. ## Why is this bad? Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake. ## Example ```python foo = { "bar": 1, "baz": 2, "baz": 3, } foo["baz"] # 3 ``` Use instead: ```python foo = { "bar": 1, "baz": 2, } foo["baz"] # 2 ``` ## References - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) Signed-off-by: Christian Clauss <[email protected]> Signed-off-by: enricosutera <[email protected]>
Marc-Morcos
pushed a commit
to Marc-Morcos/navigation2
that referenced
this pull request
Jul 4, 2024
…os-navigation#4293) % `ruff check` ``` Error: nav2_system_tests/src/system/test_wrong_init_pose_launch.py:117:21: F601 Dictionary key literal `'use_composition'` repeated ``` % ` ruff rule F601` # multi-value-repeated-key-literal (F601) Derived from the **Pyflakes** linter. Fix is sometimes available. ## What it does Checks for dictionary literals that associate multiple values with the same key. ## Why is this bad? Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake. ## Example ```python foo = { "bar": 1, "baz": 2, "baz": 3, } foo["baz"] # 3 ``` Use instead: ```python foo = { "bar": 1, "baz": 2, } foo["baz"] # 2 ``` ## References - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) Signed-off-by: Christian Clauss <[email protected]>
Manos-G
pushed a commit
to Manos-G/navigation2
that referenced
this pull request
Aug 1, 2024
…os-navigation#4293) % `ruff check` ``` Error: nav2_system_tests/src/system/test_wrong_init_pose_launch.py:117:21: F601 Dictionary key literal `'use_composition'` repeated ``` % ` ruff rule F601` # multi-value-repeated-key-literal (F601) Derived from the **Pyflakes** linter. Fix is sometimes available. ## What it does Checks for dictionary literals that associate multiple values with the same key. ## Why is this bad? Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake. ## Example ```python foo = { "bar": 1, "baz": 2, "baz": 3, } foo["baz"] # 3 ``` Use instead: ```python foo = { "bar": 1, "baz": 2, } foo["baz"] # 2 ``` ## References - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) Signed-off-by: Christian Clauss <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
%
ruff check
%
ruff rule F601
multi-value-repeated-key-literal (F601)
Derived from the Pyflakes linter.
Fix is sometimes available.
What it does
Checks for dictionary literals that associate multiple values with the same key.
Why is this bad?
Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake.
Example
Use instead:
References
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
Future work that may be required in bullet points
For Maintainers: