Path 1: 851 calls (0.75)

Compare (851)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)
            

Path 2: 280 calls (0.25)

Compare (280)

None (280)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)
            

Path 3: 4 calls (0.0)

Compare (4)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)
            

Path 4: 3 calls (0.0)

Compare (3)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)
            

Path 5: 2 calls (0.0)

Compare (2)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)
            

Path 6: 1 calls (0.0)

Compare (1)

GeneratorExit (1)

1def _check_callable_comparison(self, node: nodes.Compare) -> None:
2        operator = node.ops[0][0]
3        if operator not in COMPARISON_OPERATORS:
4            return
5
6        bare_callables = (nodes.FunctionDef, astroid.BoundMethod)
7        left_operand, right_operand = node.left, node.ops[0][1]
8        # this message should be emitted only when there is comparison of bare callable
9        # with non bare callable.
10        number_of_bare_callables = 0
11        for operand in left_operand, right_operand:
12            inferred = utils.safe_infer(operand)
13            # Ignore callables that raise, as well as typing constants
14            # implemented as functions (that raise via their decorator)
15            if (
16                isinstance(inferred, bare_callables)
17                and "typing._SpecialForm" not in inferred.decoratornames()
18                and not any(isinstance(x, nodes.Raise) for x in inferred.body)
19            ):
20                number_of_bare_callables += 1
21        if number_of_bare_callables == 1:
22            self.add_message("comparison-with-callable", node=node)