Method: pylint.extensions.no_self_use.NoSelfUseChecker.leave_functiondef
Calls: 32, Exceptions: 0, Paths: 12Back
Path 1: 7 calls (0.22)
FunctionDef (6) AsyncFunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 2: 5 calls (0.16)
FunctionDef (5)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 3: 4 calls (0.12)
FunctionDef (3) AsyncFunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 4: 4 calls (0.12)
FunctionDef (4)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 5: 3 calls (0.09)
FunctionDef (3)
None (3)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 6: 2 calls (0.06)
FunctionDef (2)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 7: 2 calls (0.06)
FunctionDef (2)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 8: 1 calls (0.03)
FunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 9: 1 calls (0.03)
FunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 10: 1 calls (0.03)
FunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 11: 1 calls (0.03)
FunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)
Path 12: 1 calls (0.03)
FunctionDef (1)
1def leave_functiondef(self, node: nodes.FunctionDef) -> None:
2 """On method node, check if this method couldn't be a function.
3
4 ignore class, static and abstract methods, initializer,
5 methods overridden from a parent class.
6 """
7 if node.is_method():
8 first = self._first_attrs.pop()
9 if first is None:
10 return
11 class_node = node.parent.frame(future=True)
12 if (
13 self._meth_could_be_func
14 and node.type == "method"
15 and node.name not in PYMETHODS
16 and not (
17 node.is_abstract()
18 or overrides_a_method(class_node, node.name)
19 or decorated_with_property(node)
20 or _has_bare_super_call(node)
21 or is_protocol_class(class_node)
22 or is_overload_stub(node)
23 )
24 ):
25 self.add_message("no-self-use", node=node, confidence=INFERENCE)