Changed semantics of ClassVar attributes in classes, fixes #1502

This commit is contained in:
Dave Halter committed 2020-03-13 12:54:29 +01:00
1 parent b4fa42a282
commit 521e240c5f
2 files changed
+8 -4

No files matched your search

+5 -1
View File
@@ -115,7 +115,11 @@ class ClassFilter(ParserTreeFilter):
annassign = expr_stmt.children[1]
if annassign.type == 'annassign':
# TODO this is not proper matching
if 'ClassVar' not in annassign.children[1].get_code():
# If there is an =, the variable is obviously also
# defined on the class.
if 'ClassVar' not in annassign.children[1].get_code() \
and '=' not in annassign.children:
return False
# Filter for name mangling of private variables like __foo