eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py

changeset 8218
7c09585bd960
parent 8216
6a042a54e0f7
child 8219
013aee248a62
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
61 Constructor 61 Constructor
62 62
63 @param errorCallback callback function to register an error 63 @param errorCallback callback function to register an error
64 @type func 64 @type func
65 """ 65 """
66 super(SimplifyNodeVisitor, self).__init__() 66 super().__init__()
67 67
68 self.__error = errorCallback 68 self.__error = errorCallback
69 69
70 self.__classDefinitionStack = [] 70 self.__classDefinitionStack = []
71 71
1154 self.__error(node.lineno - 1, node.col_offset, "Y181", 1154 self.__error(node.lineno - 1, node.col_offset, "Y181",
1155 unparse(newNode), unparse(node)) 1155 unparse(newNode), unparse(node))
1156 1156
1157 def __check182(self, node): 1157 def __check182(self, node):
1158 """ 1158 """
1159 Private method to check for calls of type 'super(Foo, self)' that could 1159 Private method to check for calls of type 'super()' that could
1160 be shortened to 'super()'. 1160 be shortened to 'super()'.
1161 1161
1162 @param node reference to the AST node to be checked 1162 @param node reference to the AST node to be checked
1163 @type ast.Call 1163 @type ast.Call
1164 """ 1164 """
1165 # super(Foo, self) 1165 # super()
1166 if ( 1166 if (
1167 self.__classDefinitionStack and 1167 self.__classDefinitionStack and
1168 isinstance(node.func, ast.Name) and 1168 isinstance(node.func, ast.Name) and
1169 node.func.id == "super" and 1169 node.func.id == "super" and
1170 len(node.args) == 2 and 1170 len(node.args) == 2 and

eric ide

mercurial