Path 1: 659 calls (1.0)

ClassDef (644) ExceptionInstance (9) Instance (2) Tuple (2) FunctionDef (1) Const (1)

True (642) False (17)

GeneratorExit (642)

1def inherit_from_std_ex(node: nodes.NodeNG | astroid.Instance) -> bool:
2    """Return whether the given class node is subclass of
3    exceptions.Exception.
4    """
5    ancestors = node.ancestors() if hasattr(node, "ancestors") else []
6    return any(
7        ancestor.name in {"Exception", "BaseException"}
8        and ancestor.root().name == EXCEPTIONS_MODULE
9        for ancestor in itertools.chain([node], ancestors)
10    )