Path 1: 825 calls (0.97)

Name (243) Attribute (202) Import (123) ImportFrom (121) Raise (116) Call (6) AssignName (6) DelName (4) BinOp (3) DelAttr (1)

NameError def (253) ImportError def (244) AttributeError def (203) 'RuntimeError' (42) 'NameError' (23) 'error' (18) StopIteration def (12) 'ValueErro...

1def get_contextlib_suppressors(
2    node: nodes.NodeNG, exception: type[Exception] | str = Exception
3) -> Iterator[nodes.With]:
4    """Return the contextlib suppressors handling the exception.
5
6    Args:
7        node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress.
8        exception (builtin.Exception): exception or name of the exception.
9
10    Yields:
11        nodes.With: A with node that is suppressing the exception.
12    """
13    for with_node in get_contextlib_with_statements(node):
14        for item, _ in with_node.items:
15            if isinstance(item, nodes.Call):
16                inferred = safe_infer(item.func)
17                if (
18                    isinstance(inferred, nodes.ClassDef)
19                    and inferred.qname() == "contextlib.suppress"
20                ):
21                    if _suppresses_exception(item, exception):
22                        yield with_node
            

Path 2: 16 calls (0.02)

Name (16)

NameError def (16)

1def get_contextlib_suppressors(
2    node: nodes.NodeNG, exception: type[Exception] | str = Exception
3) -> Iterator[nodes.With]:
4    """Return the contextlib suppressors handling the exception.
5
6    Args:
7        node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress.
8        exception (builtin.Exception): exception or name of the exception.
9
10    Yields:
11        nodes.With: A with node that is suppressing the exception.
12    """
13    for with_node in get_contextlib_with_statements(node):
14        for item, _ in with_node.items:
15            if isinstance(item, nodes.Call):
16                inferred = safe_infer(item.func)
17                if (
18                    isinstance(inferred, nodes.ClassDef)
19                    and inferred.qname() == "contextlib.suppress"
20                ):
21                    if _suppresses_exception(item, exception):
22                        yield with_node
            

Path 3: 6 calls (0.01)

Import (6)

ImportError def (6)

With (6) None (6)

GeneratorExit (6)

1def get_contextlib_suppressors(
2    node: nodes.NodeNG, exception: type[Exception] | str = Exception
3) -> Iterator[nodes.With]:
4    """Return the contextlib suppressors handling the exception.
5
6    Args:
7        node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress.
8        exception (builtin.Exception): exception or name of the exception.
9
10    Yields:
11        nodes.With: A with node that is suppressing the exception.
12    """
13    for with_node in get_contextlib_with_statements(node):
14        for item, _ in with_node.items:
15            if isinstance(item, nodes.Call):
16                inferred = safe_infer(item.func)
17                if (
18                    isinstance(inferred, nodes.ClassDef)
19                    and inferred.qname() == "contextlib.suppress"
20                ):
21                    if _suppresses_exception(item, exception):
22                        yield with_node
            

Path 4: 3 calls (0.0)

Name (3)

NameError def (3)

1def get_contextlib_suppressors(
2    node: nodes.NodeNG, exception: type[Exception] | str = Exception
3) -> Iterator[nodes.With]:
4    """Return the contextlib suppressors handling the exception.
5
6    Args:
7        node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress.
8        exception (builtin.Exception): exception or name of the exception.
9
10    Yields:
11        nodes.With: A with node that is suppressing the exception.
12    """
13    for with_node in get_contextlib_with_statements(node):
14        for item, _ in with_node.items:
15            if isinstance(item, nodes.Call):
16                inferred = safe_infer(item.func)
17                if (
18                    isinstance(inferred, nodes.ClassDef)
19                    and inferred.qname() == "contextlib.suppress"
20                ):
21                    if _suppresses_exception(item, exception):
22                        yield with_node
            

Path 5: 1 calls (0.0)

Import (1)

ImportError def (1)

1def get_contextlib_suppressors(
2    node: nodes.NodeNG, exception: type[Exception] | str = Exception
3) -> Iterator[nodes.With]:
4    """Return the contextlib suppressors handling the exception.
5
6    Args:
7        node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress.
8        exception (builtin.Exception): exception or name of the exception.
9
10    Yields:
11        nodes.With: A with node that is suppressing the exception.
12    """
13    for with_node in get_contextlib_with_statements(node):
14        for item, _ in with_node.items:
15            if isinstance(item, nodes.Call):
16                inferred = safe_infer(item.func)
17                if (
18                    isinstance(inferred, nodes.ClassDef)
19                    and inferred.qname() == "contextlib.suppress"
20                ):
21                    if _suppresses_exception(item, exception):
22                        yield with_node