From 7c60d0c44a9519d8ff8883fe1dc7c2ac6ccba146 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 3 May 2024 18:41:44 +0200 Subject: [PATCH] ruff rule F601 - Dictionary key literal `'use_composition'` repeated (#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 --- nav2_system_tests/src/system/test_wrong_init_pose_launch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py index d09cc54919..f42d276fcc 100755 --- a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py +++ b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py @@ -114,7 +114,6 @@ def generate_launch_description(): 'bt_xml_file': bt_navigator_xml, 'use_composition': 'False', 'autostart': 'True', - 'use_composition': 'False', }.items(), ), ]