Method: pylint.checkers.classes.class_checker._ancestors_to_call
Calls: 319, Exceptions: 0, Paths: 5Back
Path 1: 270 calls (0.85)
ClassDef (270)
'__init__' (270)
{} (270)
1def _ancestors_to_call(
2 klass_node: nodes.ClassDef, method_name: str = "__init__"
3) -> dict[nodes.ClassDef, bases.UnboundMethod]:
4 """Return a dictionary where keys are the list of base classes providing
5 the queried method, and so that should/may be called from the method node.
6 """
7 to_call: dict[nodes.ClassDef, bases.UnboundMethod] = {}
8 for base_node in klass_node.ancestors(recurs=False):
9 try:
10 init_node = next(base_node.igetattr(method_name))
11 if not isinstance(init_node, astroid.UnboundMethod):
12 continue
13 if init_node.is_abstract():
14 continue
15 to_call[base_node] = init_node
16 except astroid.InferenceError:
17 continue
18 return to_call
Path 2: 42 calls (0.13)
ClassDef (42)
'__init__' (42)
dict (42)
1def _ancestors_to_call(
2 klass_node: nodes.ClassDef, method_name: str = "__init__"
3) -> dict[nodes.ClassDef, bases.UnboundMethod]:
4 """Return a dictionary where keys are the list of base classes providing
5 the queried method, and so that should/may be called from the method node.
6 """
7 to_call: dict[nodes.ClassDef, bases.UnboundMethod] = {}
8 for base_node in klass_node.ancestors(recurs=False):
9 try:
10 init_node = next(base_node.igetattr(method_name))
11 if not isinstance(init_node, astroid.UnboundMethod):
12 continue
13 if init_node.is_abstract():
14 continue
15 to_call[base_node] = init_node
16 except astroid.InferenceError:
17 continue
18 return to_call
Path 3: 5 calls (0.02)
ClassDef (5)
'__init__' (5)
{} (5)
1def _ancestors_to_call(
2 klass_node: nodes.ClassDef, method_name: str = "__init__"
3) -> dict[nodes.ClassDef, bases.UnboundMethod]:
4 """Return a dictionary where keys are the list of base classes providing
5 the queried method, and so that should/may be called from the method node.
6 """
7 to_call: dict[nodes.ClassDef, bases.UnboundMethod] = {}
8 for base_node in klass_node.ancestors(recurs=False):
9 try:
10 init_node = next(base_node.igetattr(method_name))
11 if not isinstance(init_node, astroid.UnboundMethod):
12 continue
13 if init_node.is_abstract():
14 continue
15 to_call[base_node] = init_node
16 except astroid.InferenceError:
17 continue
18 return to_call
Path 4: 1 calls (0.0)
ClassDef (1)
'__init__' (1)
dict (1)
1def _ancestors_to_call(
2 klass_node: nodes.ClassDef, method_name: str = "__init__"
3) -> dict[nodes.ClassDef, bases.UnboundMethod]:
4 """Return a dictionary where keys are the list of base classes providing
5 the queried method, and so that should/may be called from the method node.
6 """
7 to_call: dict[nodes.ClassDef, bases.UnboundMethod] = {}
8 for base_node in klass_node.ancestors(recurs=False):
9 try:
10 init_node = next(base_node.igetattr(method_name))
11 if not isinstance(init_node, astroid.UnboundMethod):
12 continue
13 if init_node.is_abstract():
14 continue
15 to_call[base_node] = init_node
16 except astroid.InferenceError:
17 continue
18 return to_call
Path 5: 1 calls (0.0)
ClassDef (1)
'__init__' (1)
{} (1)
1def _ancestors_to_call(
2 klass_node: nodes.ClassDef, method_name: str = "__init__"
3) -> dict[nodes.ClassDef, bases.UnboundMethod]:
4 """Return a dictionary where keys are the list of base classes providing
5 the queried method, and so that should/may be called from the method node.
6 """
7 to_call: dict[nodes.ClassDef, bases.UnboundMethod] = {}
8 for base_node in klass_node.ancestors(recurs=False):
9 try:
10 init_node = next(base_node.igetattr(method_name))
11 if not isinstance(init_node, astroid.UnboundMethod):
12 continue
13 if init_node.is_abstract():
14 continue
15 to_call[base_node] = init_node
16 except astroid.InferenceError:
17 continue
18 return to_call