Path 1: 430 calls (0.82)

For (430)

None (430)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 2: 61 calls (0.12)

For (61)

None (61)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 3: 15 calls (0.03)

For (15)

None (15)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 4: 8 calls (0.02)

For (8)

None (8)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 5: 6 calls (0.01)

For (6)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 6: 2 calls (0.0)

For (2)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)
            

Path 7: 1 calls (0.0)

For (1)

1@utils.only_required_for_messages(
2        "unbalanced-dict-unpacking",
3    )
4    def visit_for(self, node: nodes.For) -> None:
5        if not isinstance(node.target, nodes.Tuple):
6            return
7
8        targets = node.target.elts
9
10        inferred = utils.safe_infer(node.iter)
11        if not isinstance(inferred, DICT_TYPES):
12            return
13
14        values = self._nodes_to_unpack(inferred)
15        if not values:
16            # no dict items returned
17            return
18
19        if isinstance(inferred, astroid.objects.DictItems):
20            # dict.items() is a bit special because values will be a tuple
21            # So as long as there are always 2 targets and values each are
22            # a tuple with two items, this will unpack correctly.
23            # Example: `for key, val in {1: 2, 3: 4}.items()`
24            if len(targets) == 2 and all(len(x.elts) == 2 for x in values):
25                return
26
27            # Starred nodes indicate ambiguous unpacking
28            # if `dict.items()` is used so we won't flag them.
29            if any(isinstance(target, nodes.Starred) for target in targets):
30                return
31
32        if len(targets) != len(values):
33            details = _get_unpacking_extra_info(node, inferred)
34            self._report_unbalanced_unpacking(node, inferred, targets, values, details)