From: Neal N. <nno...@us...> - 2002-06-06 16:57:01
|
Update of /cvsroot/pychecker/pychecker/pychecker In directory usw-pr-cvs1:/tmp/cvs-serv5645/pychecker Modified Files: checker.py Log Message: Patch #535959 by Greg Ward, simply and improve addMethod[s]() Index: checker.py =================================================================== RCS file: /cvsroot/pychecker/pychecker/pychecker/checker.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** checker.py 6 Jun 2002 14:24:57 -0000 1.57 --- checker.py 6 Jun 2002 16:56:58 -0000 1.58 *************** *** 239,258 **** return func_name ! def addMethod(self, method, className = None, methodName = None) : if type(method) == types.StringType : self.methods[method] = None ! return ! if not hasattr(method, "func_name") : ! return ! ! if not methodName : ! methodName = self.__getMethodName(method.func_name, className) ! self.methods[methodName] = function.Function(method) def addMethods(self, classObject) : for classToken in _getClassTokens(classObject) : token = getattr(classObject, classToken) ! if type(token) == types.MethodType : ! self.addMethod(token.im_func, classObject.__name__, token.__name__) elif hasattr(token, '__get__') and \ not hasattr(token, '__set__') and \ --- 239,259 ---- return func_name ! def addMethod(self, method, methodName = None) : if type(method) == types.StringType : self.methods[method] = None ! else : ! assert methodName is not None, "must supply methodName" ! self.methods[methodName] = function.Function(method) def addMethods(self, classObject) : for classToken in _getClassTokens(classObject) : token = getattr(classObject, classToken) ! ! # Looks like a method. Need to code it this way to ! # accommodate ExtensionClass and Python 2.2. Yecchh. ! if (hasattr(token, "func_code") and ! hasattr(token.func_code, "co_argcount")): ! self.addMethod(token, token.__name__) ! elif hasattr(token, '__get__') and \ not hasattr(token, '__set__') and \ |