Skip to content

Commit b6b0632

Browse files
committed
fix: handle attribute error
1 parent deea595 commit b6b0632

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tutor_flake/rules/classvar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def check(cls, node: ast.ClassDef) -> Generator[Flake8Error, None, None]:
2222
yield Flake8Error.construct(
2323
child,
2424
501,
25-
f"Class variable `{target.id}` instantiated after methods", # type: ignore
25+
(
26+
f"Class variable `{target.id}` instantiated after methods" # type: ignore
27+
if not isinstance(target, ast.Attribute)
28+
else "Class variable instantiated after methods"
29+
),
2630
cls,
2731
)
2832
if not cls.is_class_exempt_from_type_annotations(

0 commit comments

Comments
 (0)