def _initModule(self, module): self.module = module self.attributes = dir(self.module) pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None : utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) for tokenName in _filterDir(self.module, _DEFAULT_MODULE_TOKENS) : token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType) : # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType) : self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') : self.addClass(tokenName) else : self.addVariable(tokenName, type(token)) if pychecker_attr is not None : utils.popConfig() return 1
def _initModule(self, module): self.module = module self.attributes = dir(self.module) pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None : utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) for tokenName in _filterDir(self.module, _DEFAULT_MODULE_TOKENS) : if _EVIL_C_OBJECTS.has_key('%s.%s' % (self.moduleName, tokenName)): continue # README if interpreter is crashing: # Change 0 to 1 if the interpretter is crashing and re-run. # Follow the instructions from the last line printed. if 0: print "Add the following line to _EVIL_C_OBJECTS:\n" \ " '%s.%s': None, " % (self.moduleName, tokenName) token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType) : # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType) : self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') : self.addClass(tokenName) else : self.addVariable(tokenName, type(token)) if pychecker_attr is not None : utils.popConfig() return 1
def _initModule(self, module): self.module = module self.attributes = dir(self.module) pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None: utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) for tokenName in _filterDir(self.module, _DEFAULT_MODULE_TOKENS): token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType): # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType): self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') : self.addClass(tokenName) else: self.addVariable(tokenName, type(token)) if pychecker_attr is not None: utils.popConfig() return 1
def _initModule(self, module): self.module = module self.attributes = dir(self.module) pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None: utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) for tokenName in _filterDir(self.module, _DEFAULT_MODULE_TOKENS): if _EVIL_C_OBJECTS.has_key('%s.%s' % (self.moduleName, tokenName)): continue # README if interpreter is crashing: # Change 0 to 1 if the interpretter is crashing and re-run. # Follow the instructions from the last line printed. if 0: print "Add the following line to _EVIL_C_OBJECTS:\n" \ " '%s.%s': None, " % (self.moduleName, tokenName) token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType): # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType): self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') : self.addClass(tokenName) else: self.addVariable(tokenName, type(token)) if pychecker_attr is not None: utils.popConfig() return 1
def _initModule(self, module): self.module = module self.attributes = dir(self.module) # interpret module-specific suppressions pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None : utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) # read all tokens from the real module, and register them for tokenName in _getModuleTokens(self.module): if EVIL_C_OBJECTS.has_key('%s.%s' % (self.moduleName, tokenName)): continue # README if interpreter is crashing: # Change 0 to 1 if the interpretter is crashing and re-run. # Follow the instructions from the last line printed. if utils.cfg().findEvil: print "Add the following line to EVIL_C_OBJECTS or the string to evil in a config file:\n" \ " '%s.%s': None, " % (self.moduleName, tokenName) token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType) : # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType) : self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') and \ issubclass(type(token), type): self.addClass(tokenName) else : self.addVariable(tokenName, type(token)) if pychecker_attr is not None : utils.popConfig() return 1
def _initModule(self, module): self.module = module self.attributes = dir(self.module) # interpret module-specific suppressions pychecker_attr = getattr(module, Config.CHECKER_VAR, None) if pychecker_attr is not None: utils.pushConfig() utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, []) # read all tokens from the real module, and register them for tokenName in _getModuleTokens(self.module): if EVIL_C_OBJECTS.has_key('%s.%s' % (self.moduleName, tokenName)): continue # README if interpreter is crashing: # Change 0 to 1 if the interpretter is crashing and re-run. # Follow the instructions from the last line printed. if utils.cfg().findEvil: print "Add the following line to EVIL_C_OBJECTS or the string to evil in a config file:\n" \ " '%s.%s': None, " % (self.moduleName, tokenName) token = getattr(self.module, tokenName) if isinstance(token, types.ModuleType): # get the real module name, tokenName could be an alias self.addModule(token.__name__) elif isinstance(token, types.FunctionType): self.addFunction(token) elif isinstance(token, types.ClassType) or \ hasattr(token, '__bases__') and \ issubclass(type(token), type): self.addClass(tokenName) else: self.addVariable(tokenName, type(token)) if pychecker_attr is not None: utils.popConfig() return 1
def _updateSuppressions(suppress, warnings) : if not utils.updateCheckerArgs(suppress, 'suppressions', 0, warnings) : utils.popConfig() raise _SuppressionError