def _check_generator(self, node: AnyFunctionDef) -> None: if not functions.is_generator(node): return for sub_node in walk.get_subnodes_by_type(node, ast.Raise): if exceptions.get_exception_name(sub_node) == 'StopIteration': self.add_violation( StopIterationInsideGeneratorViolation(sub_node), )
def _check_exception_type(self, node: ast.Raise) -> None: exception_name = get_exception_name(node) if exception_name == 'NotImplemented': self.add_violation(RaiseNotImplementedViolation(node))