pylint/utils/ast_walker.py
def add_checker(self, checker):
        """walk to the checker's dir and collect visit and leave methods"""
        # XXX : should be possible to merge needed_checkers and add_checker
        vcids = set()
        lcids = set()
        visits = self.visit_events
        leaves = self.leave_events
        for member in dir(checker):
            cid = member[6:]
            if cid == "default":
                continue
            if member.startswith("visit_"):
                v_meth = getattr(checker, member)
                # don't use visit_methods with no activated message:
                if self._is_method_enabled(v_meth):
                    visits[cid].append(v_meth)
                    vcids.add(cid)
            elif member.startswith("leave_"):
                l_meth = getattr(checker, member)
                # don't use leave_methods with no activated message:
                if self._is_method_enabled(l_meth):
                    leaves[cid].append(l_meth)
                    lcids.add(cid)
        visit_default = getattr(checker, "visit_default", None)
        if visit_default:
            for cls in nodes.ALL_NODE_CLASSES:
                cid = cls.__name__.lower()
                if cid not in vcids:
                    visits[cid].append(visit_default)
def add_checker(self, checker):
        """walk to the checker's dir and collect visit and leave methods"""
        # XXX : should be possible to merge needed_checkers and add_checker
        vcids = set()
        lcids = set()
        visits = self.visit_events
        leaves = self.leave_events
        for member in dir(checker):
            cid = member[6:]
            if cid == "default":
                continue
            if member.startswith("visit_"):
                v_meth = getattr(checker, member)
                # don't use visit_methods with no activated message:
                if self._is_method_enabled(v_meth):
                    visits[cid].append(v_meth)
                    vcids.add(cid)
            elif member.startswith("leave_"):
                l_meth = getattr(checker, member)
                # don't use leave_methods with no activated message:
                if self._is_method_enabled(l_meth):
                    leaves[cid].append(l_meth)
                    lcids.add(cid)
        visit_default = getattr(checker, "visit_default", None)
        if visit_default:
            for cls in nodes.ALL_NODE_CLASSES:
                cid = cls.__name__.lower()
                if cid not in vcids:
                    visits[cid].append(visit_default)
def add_checker ( self , checker ) : # XXX : should be possible to merge needed_checkers and add_checker vcids = set ( ) lcids = set ( ) visits = self . visit_events leaves = self . leave_events for member in dir ( checker ) : cid = member [ 6 : ] if cid == "default" : continue if member . startswith ( "visit_" ) : v_meth = getattr ( checker , member ) # don't use visit_methods with no activated message: if self . _is_method_enabled ( v_meth ) : visits [ cid ] . append ( v_meth ) vcids . add ( cid ) elif member . startswith ( "leave_" ) : l_meth = getattr ( checker , member ) # don't use leave_methods with no activated message: if self . _is_method_enabled ( l_meth ) : leaves [ cid ] . append ( l_meth ) lcids . add ( cid ) visit_default = getattr ( checker , "visit_default" , None ) if visit_default : for cls in nodes . ALL_NODE_CLASSES : cid = cls . __name__ . lower ( ) if cid not in vcids : visits [ cid ] . append ( visit_default )
walk to the checker's dir and collect visit and leave methods
walk to the checker s dir and collect visit and leave methods