Path 1: 8 calls (0.29)

Name (6) Attribute (2)

False (8)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 2: 4 calls (0.14)

Name (4)

True (4)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 3: 3 calls (0.11)

Name (2) Attribute (1)

True (3)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 4: 3 calls (0.11)

Attribute (2) Name (1)

False (3)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 5: 2 calls (0.07)

Name (2)

False (2)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 6: 2 calls (0.07)

Name (2)

False (2)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 7: 1 calls (0.04)

Name (1)

False (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 8: 1 calls (0.04)

Name (1)

False (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 9: 1 calls (0.04)

Name (1)

True (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 10: 1 calls (0.04)

Name (1)

True (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 11: 1 calls (0.04)

Name (1)

False (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True
            

Path 12: 1 calls (0.04)

Name (1)

False (1)

1def _broken_callable_location(self, node: nodes.Name | nodes.Attribute) -> bool:
2        """Check if node would be a broken location for collections.abc.Callable."""
3        if (
4            in_type_checking_block(node)
5            or is_postponed_evaluation_enabled(node)
6            and is_node_in_type_annotation_context(node)
7        ):
8            return False
9
10        # Check first Callable arg is a list of arguments -> Callable[[int], None]
11        if not (
12            isinstance(node.parent, nodes.Subscript)
13            and isinstance(node.parent.slice, nodes.Tuple)
14            and len(node.parent.slice.elts) == 2
15            and isinstance(node.parent.slice.elts[0], nodes.List)
16        ):
17            return False
18
19        # Check nested inside Optional or Union
20        parent_subscript = node.parent.parent
21        if isinstance(parent_subscript, nodes.BaseContainer):
22            parent_subscript = parent_subscript.parent
23        if not (
24            isinstance(parent_subscript, nodes.Subscript)
25            and isinstance(parent_subscript.value, (nodes.Name, nodes.Attribute))
26        ):
27            return False
28
29        inferred_parent = safe_infer(parent_subscript.value)
30        if not (
31            isinstance(inferred_parent, nodes.FunctionDef)
32            and inferred_parent.qname() in {"typing.Optional", "typing.Union"}
33            or isinstance(inferred_parent, astroid.bases.Instance)
34            and inferred_parent.qname() == "typing._SpecialForm"
35        ):
36            return False
37
38        return True