From: Neal N. <nno...@us...> - 2004-06-07 02:58:24
|
Update of /cvsroot/pychecker/pychecker/pychecker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29359/pychecker Modified Files: CodeChecks.py Log Message: handle passing (checking) **kwargs for methods on builtin objects Index: CodeChecks.py =================================================================== RCS file: /cvsroot/pychecker/pychecker/pychecker/CodeChecks.py,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** CodeChecks.py 6 Jun 2004 15:12:24 -0000 1.153 --- CodeChecks.py 7 Jun 2004 02:58:16 -0000 1.154 *************** *** 121,124 **** --- 121,134 ---- return c.methods.get(identifier[-1], None), c, 0 + def _validateKwArgs(code, info, func_name, kwArgs): + if len(info) < 4: + code.addWarning(msgs.FUNC_DOESNT_SUPPORT_KW % func_name) + elif not info[3]: + return + + for arg in kwArgs: + if arg not in info[3]: + code.addWarning(msgs.FUNC_DOESNT_SUPPORT_KW_ARG % (func_name, arg)) + def _checkBuiltin(code, loadValue, argCount, kwArgs, check_arg_count = 1) : returnValue = Stack.makeFuncReturnValue(loadValue, argCount) *************** *** 137,146 **** if kwArgs: ! if len(info) < 4: ! code.addWarning(msgs.FUNC_DOESNT_SUPPORT_KW % func_name) ! elif info[3]: ! for arg in kwArgs: ! if arg not in info[3]: ! code.addWarning(msgs.FUNC_DOESNT_SUPPORT_KW_ARG % (func_name, arg)) elif check_arg_count : _checkFunctionArgCount(code, func_name, argCount, --- 147,151 ---- if kwArgs: ! _validateKwArgs(code, info, func_name, kwArgs) elif check_arg_count : _checkFunctionArgCount(code, func_name, argCount, *************** *** 165,169 **** # set func properly if kwArgs : ! code.addWarning(msgs.FUNC_DOESNT_SUPPORT_KW % func_name[1]) elif methodInfo : returnValue = Stack.Item(func_name[1], methodInfo[0]) --- 170,174 ---- # set func properly if kwArgs : ! _validateKwArgs(code, methodInfo, func_name[1], kwArgs) elif methodInfo : returnValue = Stack.Item(func_name[1], methodInfo[0]) |