File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 11"""Models."""
2- from astroid .nodes import Assign , ClassDef
2+ from astroid .nodes import Assign , AssignName , ClassDef
33
44from pylint .interfaces import IAstroidChecker
55from pylint .checkers .utils import check_messages
@@ -41,14 +41,10 @@ def visit_classdef(self, node):
4141 return
4242
4343 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 )):
4546 continue
4647
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