eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py

changeset 7637
c878e8255972
parent 7360
9190402e4505
child 7639
422fd05e9c91
equal deleted inserted replaced
7636:61566f35ab22 7637:c878e8255972
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 posArgs = [arg.arg for arg in node.args.args]
192 posArgs = [arg.arg for arg in node.args.args] 192 kwOnly = [arg.arg for arg in node.args.kwonlyargs]
193 kwOnly = [arg.arg for arg in node.args.kwonlyargs] 193 return posArgs + kwOnly
194 return posArgs + kwOnly
195 else:
196 def unpackArgs(args):
197 """
198 Local helper function to unpack function argument names.
199
200 @param args list of AST node arguments
201 @return list of argument names (list of string)
202 """
203 ret = []
204 for arg in args:
205 if isinstance(arg, ast.Tuple):
206 ret.extend(unpackArgs(arg.elts))
207 else:
208 ret.append(arg.id)
209 return ret
210
211 return unpackArgs(node.args.args)
212 194
213 def __error(self, node, code): 195 def __error(self, node, code):
214 """ 196 """
215 Private method to build the error information. 197 Private method to build the error information.
216 198

eric ide

mercurial