summaryrefslogtreecommitdiff
path: root/tests/functional/c/comparison_with_callable_typing_constants.py
blob: 487edc80fb51a5592589568bac36a67a9e15a0a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Typing constants are actually implemented as functions, but they
raise when called, so Pylint uses that to avoid false positives for
comparison-with-callable.
"""
from typing import Any, Optional


def check_any(type_) -> bool:
    """See https://github.com/pylint-dev/pylint/issues/5557"""
    return type_ == Any


def check_optional(type_) -> bool:
    """
    Unlike Any, Optional does not raise in its body.
    It raises via its decorator: typing._SpecialForm.__call__()
    """
    return type_ == Optional