Path 1: 32 calls (0.8)

ClassDef (32)

None (32)

AttributeInferenceError (32)

1def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]:
2    """Return an iterator on interfaces implemented by the given class node."""
3    try:
4        implements = astroid.bases.Instance(node).getattr("__implements__")[0]
5    except astroid.exceptions.NotFoundError:
6        return
7    if implements.frame(future=True) is not node:
8        return
9    found = set()
10    missing = False
11    for iface in nodes.unpack_infer(implements):
12        if iface is astroid.Uninferable:
13            missing = True
14            continue
15        if iface not in found:
16            found.add(iface)
17            yield iface
18    if missing:
19        raise astroid.exceptions.InferenceError()
            

Path 2: 6 calls (0.15)

ClassDef (6)

ClassDef (8)

1def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]:
2    """Return an iterator on interfaces implemented by the given class node."""
3    try:
4        implements = astroid.bases.Instance(node).getattr("__implements__")[0]
5    except astroid.exceptions.NotFoundError:
6        return
7    if implements.frame(future=True) is not node:
8        return
9    found = set()
10    missing = False
11    for iface in nodes.unpack_infer(implements):
12        if iface is astroid.Uninferable:
13            missing = True
14            continue
15        if iface not in found:
16            found.add(iface)
17            yield iface
18    if missing:
19        raise astroid.exceptions.InferenceError()
            

Path 3: 2 calls (0.05)

ClassDef (2)

None (2)

1def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]:
2    """Return an iterator on interfaces implemented by the given class node."""
3    try:
4        implements = astroid.bases.Instance(node).getattr("__implements__")[0]
5    except astroid.exceptions.NotFoundError:
6        return
7    if implements.frame(future=True) is not node:
8        return
9    found = set()
10    missing = False
11    for iface in nodes.unpack_infer(implements):
12        if iface is astroid.Uninferable:
13            missing = True
14            continue
15        if iface not in found:
16            found.add(iface)
17            yield iface
18    if missing:
19        raise astroid.exceptions.InferenceError()