File tree 4 files changed +17
-9
lines changed
tests/functional/u/unused
4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ Release date: TBA
27
27
Closes #6069
28
28
Closes #6136
29
29
30
+ * Fix false positive for ``unused-import`` when disabling both ``used-before-assignment`` and ``undefined-variable``.
31
+
32
+ Closes #6089
33
+
30
34
* Narrow the scope of the ``unnecessary-ellipsis`` checker to:
31
35
* functions & classes which contain both a docstring and an ellipsis.
32
36
* A body which contains an ellipsis ``nodes.Expr`` node & at least one other statement.
Original file line number Diff line number Diff line change @@ -132,6 +132,10 @@ Other Changes
132
132
133
133
Closes #6028
134
134
135
+ * Fix false positive for ``unused-import `` when disabling both ``used-before-assignment `` and ``undefined-variable ``.
136
+
137
+ Closes #6089
138
+
135
139
* Fix false positive for ``unnecessary-ellipsis `` when using an ellipsis as a default argument.
136
140
137
141
Closes #5973
Original file line number Diff line number Diff line change @@ -1085,9 +1085,6 @@ def open(self) -> None:
1085
1085
self ._is_undefined_variable_enabled = self .linter .is_message_enabled (
1086
1086
"undefined-variable"
1087
1087
)
1088
- self ._is_used_before_assignment_enabled = self .linter .is_message_enabled (
1089
- "used-before-assignment"
1090
- )
1091
1088
self ._is_undefined_loop_variable_enabled = self .linter .is_message_enabled (
1092
1089
"undefined-loop-variable"
1093
1090
)
@@ -1550,12 +1547,6 @@ def _check_consumer(
1550
1547
1551
1548
self ._check_late_binding_closure (node )
1552
1549
1553
- if not (
1554
- self ._is_undefined_variable_enabled
1555
- or self ._is_used_before_assignment_enabled
1556
- ):
1557
- return (VariableVisitConsumerAction .RETURN , found_nodes )
1558
-
1559
1550
defnode = utils .assign_parent (found_nodes [0 ])
1560
1551
defstmt = defnode .statement (future = True )
1561
1552
defframe = defstmt .frame (future = True )
Original file line number Diff line number Diff line change 1
1
"""Test that unused-import is not emitted here when everything else is disabled
2
2
3
3
https://github.com/PyCQA/pylint/issues/3445
4
+ https://github.com/PyCQA/pylint/issues/6089
4
5
"""
6
+ from math import e , pi
5
7
from os import environ
6
8
7
9
for k , v in environ .items ():
8
10
print (k , v )
11
+
12
+
13
+ class MyClass :
14
+ """For the bug reported in #6089 it is important to use the same names for the class attributes as in the imports."""
15
+
16
+ e = float (e )
17
+ pi = pi
You can’t perform that action at this time.
0 commit comments