Path 1: 413 calls (0.24)

FunctionDef (409) AsyncFunctionDef (4)

False (413)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 2: 391 calls (0.23)

FunctionDef (387) AsyncFunctionDef (4)

False (391)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 3: 330 calls (0.19)

FunctionDef (328) AsyncFunctionDef (2)

False (330)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 4: 293 calls (0.17)

FunctionDef (288) AsyncFunctionDef (5)

False (293)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 5: 122 calls (0.07)

FunctionDef (121) AsyncFunctionDef (1)

False (122)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 6: 85 calls (0.05)

FunctionDef (85)

True (85)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 7: 68 calls (0.04)

FunctionDef (68)

False (68)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 8: 5 calls (0.0)

FunctionDef (4) AsyncFunctionDef (1)

False (5)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 9: 5 calls (0.0)

FunctionDef (5)

False (5)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 10: 2 calls (0.0)

FunctionDef (2)

False (2)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True
            

Path 11: 2 calls (0.0)

FunctionDef (2)

False (2)

1def _is_trivial_super_delegation(function: nodes.FunctionDef) -> bool:
2    """Check whether a function definition is a method consisting only of a
3    call to the same function on the superclass.
4    """
5    if (
6        not function.is_method()
7        # Adding decorators to a function changes behavior and
8        # constitutes a non-trivial change.
9        or function.decorators
10    ):
11        return False
12
13    body = function.body
14    if len(body) != 1:
15        # Multiple statements, which means this overridden method
16        # could do multiple things we are not aware of.
17        return False
18
19    statement = body[0]
20    if not isinstance(statement, (nodes.Expr, nodes.Return)):
21        # Doing something else than what we are interested in.
22        return False
23
24    call = statement.value
25    if (
26        not isinstance(call, nodes.Call)
27        # Not a super() attribute access.
28        or not isinstance(call.func, nodes.Attribute)
29    ):
30        return False
31
32    # Anything other than a super call is non-trivial.
33    super_call = safe_infer(call.func.expr)
34    if not isinstance(super_call, astroid.objects.Super):
35        return False
36
37    # The name should be the same.
38    if call.func.attrname != function.name:
39        return False
40
41    # Should be a super call with the MRO pointer being the
42    # current class and the type being the current instance.
43    current_scope = function.parent.scope()
44    if (
45        super_call.mro_pointer != current_scope
46        or not isinstance(super_call.type, astroid.Instance)
47        or super_call.type.name != current_scope.name
48    ):
49        return False
50
51    return True