Skip to content

Commit a72ba7a

Browse files
committed
use is_class_var
1 parent 5910e0d commit a72ba7a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mypy/checker.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
WithStmt,
146146
YieldExpr,
147147
get_func_def,
148+
is_class_var,
148149
is_final_node,
149150
)
150151
from mypy.operators import flip_ops, int_op_to_method, neg_ops
@@ -3271,12 +3272,7 @@ def check_redundant_annotation(self, s: AssignmentStmt) -> None:
32713272
and is_same_type(s.type, self.expr_checker.accept(s.rvalue))
32723273
):
32733274
# skip ClassVar
3274-
if any(
3275-
isinstance(lvalue, NameExpr)
3276-
and isinstance(lvalue.node, Var)
3277-
and lvalue.node.is_classvar
3278-
for lvalue in s.lvalues
3279-
):
3275+
if any(isinstance(lvalue, NameExpr) and is_class_var(lvalue) for lvalue in s.lvalues):
32803276
return
32813277

32823278
# skip dataclass and NamedTuple

0 commit comments

Comments
 (0)