File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 1
1
"""Models."""
2
- from astroid .nodes import Assign , ClassDef
2
+ from astroid .nodes import Assign , AssignName , ClassDef
3
3
4
4
from pylint .interfaces import IAstroidChecker
5
5
from pylint .checkers .utils import check_messages
@@ -41,14 +41,10 @@ def visit_classdef(self, node):
41
41
return
42
42
43
43
for child in meta .get_children ():
44
- if not isinstance (child , Assign ):
44
+ if (not isinstance (child , Assign )
45
+ or not isinstance (child .targets [0 ], AssignName )):
45
46
continue
46
47
47
- # Capture and ignore AttributeError raised when targets[0] does not
48
- # have an attribute "name"
49
- try :
50
- if child .targets [0 ].name == 'exclude' :
51
- self .add_message ('W%s04' % BASE_ID , node = child )
52
- break
53
- except AttributeError :
54
- pass
48
+ if child .targets [0 ].name == 'exclude' :
49
+ self .add_message ('W%s04' % BASE_ID , node = child )
50
+ break
You can’t perform that action at this time.
0 commit comments