Path 1: 4 calls (0.5)

Call (4)

ImportError def (4)

True (4)

1def _suppresses_exception(
2    call: nodes.Call, exception: type[Exception] | str = Exception
3) -> bool:
4    """Check if the given node suppresses the given exception."""
5    if not isinstance(exception, str):
6        exception = exception.__name__
7    for arg in call.args:
8        inferred = safe_infer(arg)
9        if isinstance(inferred, nodes.ClassDef):
10            if inferred.name == exception:
11                return True
12        elif isinstance(inferred, nodes.Tuple):
13            for elt in inferred.elts:
14                inferred_elt = safe_infer(elt)
15                if (
16                    isinstance(inferred_elt, nodes.ClassDef)
17                    and inferred_elt.name == exception
18                ):
19                    return True
20    return False
            

Path 2: 2 calls (0.25)

Call (2)

ImportError def (2)

False (2)

1def _suppresses_exception(
2    call: nodes.Call, exception: type[Exception] | str = Exception
3) -> bool:
4    """Check if the given node suppresses the given exception."""
5    if not isinstance(exception, str):
6        exception = exception.__name__
7    for arg in call.args:
8        inferred = safe_infer(arg)
9        if isinstance(inferred, nodes.ClassDef):
10            if inferred.name == exception:
11                return True
12        elif isinstance(inferred, nodes.Tuple):
13            for elt in inferred.elts:
14                inferred_elt = safe_infer(elt)
15                if (
16                    isinstance(inferred_elt, nodes.ClassDef)
17                    and inferred_elt.name == exception
18                ):
19                    return True
20    return False
            

Path 3: 2 calls (0.25)

Call (2)

ImportError def (2)

True (2)

1def _suppresses_exception(
2    call: nodes.Call, exception: type[Exception] | str = Exception
3) -> bool:
4    """Check if the given node suppresses the given exception."""
5    if not isinstance(exception, str):
6        exception = exception.__name__
7    for arg in call.args:
8        inferred = safe_infer(arg)
9        if isinstance(inferred, nodes.ClassDef):
10            if inferred.name == exception:
11                return True
12        elif isinstance(inferred, nodes.Tuple):
13            for elt in inferred.elts:
14                inferred_elt = safe_infer(elt)
15                if (
16                    isinstance(inferred_elt, nodes.ClassDef)
17                    and inferred_elt.name == exception
18                ):
19                    return True
20    return False