pylint/checkers/base.py
def _check_not_in_finally(self, node, node_name, breaker_classes=()):
        """check that a node is not inside a finally clause of a
        try...finally statement.
        If we found before a try...finally bloc a parent which its type is
        in breaker_classes, we skip the whole check."""
        # if self._tryfinallys is empty, we're not an in try...finally block
        if not self._tryfinallys:
            return
        # the node could be a grand-grand...-children of the try...finally
        _parent = node.parent
        _node = node
        while _parent and not isinstance(_parent, breaker_classes):
            if hasattr(_parent, "finalbody") and _node in _parent.finalbody:
                self.add_message("lost-exception", node=node, args=node_name)
                return
            _node = _parent
            _parent = _node.parent
def _check_not_in_finally(self, node, node_name, breaker_classes=()):
        """check that a node is not inside a finally clause of a
        try...finally statement.
        If we found before a try...finally bloc a parent which its type is
        in breaker_classes, we skip the whole check."""
        # if self._tryfinallys is empty, we're not an in try...finally block
        if not self._tryfinallys:
            return
        # the node could be a grand-grand...-children of the try...finally
        _parent = node.parent
        _node = node
        while _parent and not isinstance(_parent, breaker_classes):
            if hasattr(_parent, "finalbody") and _node in _parent.finalbody:
                self.add_message("lost-exception", node=node, args=node_name)
                return
            _node = _parent
            _parent = _node.parent
def _check_not_in_finally ( self , node , node_name , breaker_classes = ( ) ) : # if self._tryfinallys is empty, we're not an in try...finally block if not self . _tryfinallys : return # the node could be a grand-grand...-children of the try...finally _parent = node . parent _node = node while _parent and not isinstance ( _parent , breaker_classes ) : if hasattr ( _parent , "finalbody" ) and _node in _parent . finalbody : self . add_message ( "lost-exception" , node = node , args = node_name ) return _node = _parent _parent = _node . parent
check that a node is not inside a finally clause of a
        try...finally statement.
        If we found before a try...finally bloc a parent which its type is
        in breaker_classes, we skip the whole check.
check that a node is not inside a finally clause of a try ... finally statement . If we found before a try ... finally bloc a parent which its type is in breaker_classes we skip the whole check .