129 Private method to tag functions if they are methods, class methods or |
129 Private method to tag functions if they are methods, class methods or |
130 static methods. |
130 static methods. |
131 |
131 |
132 @param classNode AST tree node to tag |
132 @param classNode AST tree node to tag |
133 """ |
133 """ |
134 # try to find all 'old style decorators' like |
134 # try to find all 'old style decorators' |
135 # m = staticmethod(m) |
135 # like m = staticmethod(m) |
136 lateDecoration = {} |
136 lateDecoration = {} |
137 for node in ast.iter_child_nodes(classNode): |
137 for node in ast.iter_child_nodes(classNode): |
138 if not (isinstance(node, ast.Assign) and |
138 if not (isinstance(node, ast.Assign) and |
139 isinstance(node.value, ast.Call) and |
139 isinstance(node.value, ast.Call) and |
140 isinstance(node.value.func, ast.Name)): |
140 isinstance(node.value.func, ast.Name)): |
186 Private method to get the argument names of a function node. |
186 Private method to get the argument names of a function node. |
187 |
187 |
188 @param node AST node to extract arguments names from |
188 @param node AST node to extract arguments names from |
189 @return list of argument names (list of string) |
189 @return list of argument names (list of string) |
190 """ |
190 """ |
191 if sys.version_info[0] == 3: |
191 if sys.version_info[0] >= 3: |
192 posArgs = [arg.arg for arg in node.args.args] |
192 posArgs = [arg.arg for arg in node.args.args] |
193 kwOnly = [arg.arg for arg in node.args.kwonlyargs] |
193 kwOnly = [arg.arg for arg in node.args.kwonlyargs] |
194 return posArgs + kwOnly |
194 return posArgs + kwOnly |
195 else: |
195 else: |
196 def unpackArgs(args): |
196 def unpackArgs(args): |