Path 1: 1951 calls (0.52)

Assign (1951)

None (1951)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 2: 907 calls (0.24)

Assign (907)

None (907)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 3: 385 calls (0.1)

Assign (385)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 4: 206 calls (0.06)

Assign (206)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 5: 86 calls (0.02)

Assign (86)

None (86)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 6: 74 calls (0.02)

Assign (74)

None (74)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 7: 38 calls (0.01)

Assign (38)

None (38)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 8: 35 calls (0.01)

Assign (35)

None (35)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 9: 32 calls (0.01)

Assign (32)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 10: 9 calls (0.0)

Assign (9)

None (9)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 11: 7 calls (0.0)

Assign (7)

None (7)

GeneratorExit (7)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 12: 3 calls (0.0)

Assign (3)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 13: 2 calls (0.0)

Assign (2)

None (2)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 14: 1 calls (0.0)

Assign (1)

None (1)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 15: 1 calls (0.0)

Assign (1)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 16: 1 calls (0.0)

Assign (1)

None (1)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 17: 1 calls (0.0)

Assign (1)

GeneratorExit (1)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))
            

Path 18: 1 calls (0.0)

Assign (1)

None (1)

1def _check_self_cls_assign(self, node: nodes.Assign) -> None:
2        """Check that self/cls don't get assigned."""
3        assign_names: set[str | None] = set()
4        for target in node.targets:
5            if isinstance(target, nodes.AssignName):
6                assign_names.add(target.name)
7            elif isinstance(target, nodes.Tuple):
8                assign_names.update(
9                    elt.name for elt in target.elts if isinstance(elt, nodes.AssignName)
10                )
11        scope = node.scope()
12        nonlocals_with_same_name = any(
13            child for child in scope.body if isinstance(child, nodes.Nonlocal)
14        )
15        if nonlocals_with_same_name:
16            scope = node.scope().parent.scope()
17
18        if not (
19            isinstance(scope, nodes.FunctionDef)
20            and scope.is_method()
21            and "builtins.staticmethod" not in scope.decoratornames()
22        ):
23            return
24        argument_names = scope.argnames()
25        if not argument_names:
26            return
27        self_cls_name = argument_names[0]
28        if self_cls_name in assign_names:
29            self.add_message("self-cls-assignment", node=node, args=(self_cls_name,))