40 @param checker reference to the checker object |
40 @param checker reference to the checker object |
41 @type ImportsChecker |
41 @type ImportsChecker |
42 @exception ImportNodeException raised to indicate an invalid node was |
42 @exception ImportNodeException raised to indicate an invalid node was |
43 given to this class |
43 given to this class |
44 """ |
44 """ |
45 if ( |
45 if not isinstance(astNode, (ast.Import, ast.ImportFrom)): |
46 self.nodeType not in (NodeTypeEnum.IMPORT, |
|
47 NodeTypeEnum.IMPORT_FROM) |
|
48 ): |
|
49 raise ImportNodeException( |
46 raise ImportNodeException( |
50 "Node type {0} not recognized".format(type(astNode)) |
47 "Node type {0} not recognized".format(type(astNode)) |
51 ) |
48 ) |
52 |
49 |
53 self.node = astNode |
50 self.node = astNode |