コード例 #1
0
 def _check_exception_type(self, node: ast.Raise) -> None:
     exception_name = get_exception_name(node)
     if exception_name == 'NotImplemented':
         self.add_violation(RaiseNotImplementedViolation(node))
     elif exception_name in self._base_exceptions:
         self.add_violation(
             BaseExceptionRaiseViolation(node, text=exception_name), )
コード例 #2
0
    def _check_exception_type(self, node: ast.Raise) -> None:
        exception = getattr(node, 'exc', None)
        if exception is None:
            return

        exception_func = getattr(exception, 'func', None)
        if exception_func:
            exception = exception_func

        exception_name = getattr(exception, 'id', None)
        if exception_name == 'NotImplemented':
            self.add_violation(RaiseNotImplementedViolation(node))
コード例 #3
0
 def _check_exception_type(self, node: ast.Raise) -> None:
     exception_name = get_exception_name(node)
     if exception_name == 'NotImplemented':
         self.add_violation(RaiseNotImplementedViolation(node))