1120 # in the body the developer might remove the element from the list. |
1120 # in the body the developer might remove the element from the list. |
1121 # We need to have a look at the body. |
1121 # We need to have a look at the body. |
1122 isinstance(node.body[0], ast.Assign) and |
1122 isinstance(node.body[0], ast.Assign) and |
1123 isinstance(node.body[0].value, ast.Subscript) and |
1123 isinstance(node.body[0].value, ast.Subscript) and |
1124 len(node.body[0].targets) == 1 and |
1124 len(node.body[0].targets) == 1 and |
1125 isinstance(node.body[0].targets[0], ast.Name) |
1125 isinstance(node.body[0].targets[0], ast.Name) and |
|
1126 isinstance(node.body[0].value.value, ast.Name) and |
|
1127 isinstance(node.test.comparators[0], ast.Name) and |
|
1128 node.body[0].value.value.id == node.test.comparators[0].id |
1126 ): |
1129 ): |
1127 key = unparse(node.test.left) |
1130 key = unparse(node.test.left) |
1128 dictname = unparse(node.test.comparators[0]) |
1131 dictname = unparse(node.test.comparators[0]) |
1129 self.__error(node.lineno - 1, node.col_offset, "Y122", |
1132 self.__error(node.lineno - 1, node.col_offset, "Y122", |
1130 dictname, key) |
1133 dictname, key) |