def is_tuple_type()

in azure_functions_worker/_thirdparty/typing_inspect.py [0:0]


def is_tuple_type(tp):
    """Test if the type is a generic tuple type, including subclasses excluding
    non-generic classes.
    Examples::

        is_tuple_type(int) == False
        is_tuple_type(tuple) == False
        is_tuple_type(Tuple) == True
        is_tuple_type(Tuple[str, int]) == True
        class MyClass(Tuple[str, int]):
            ...
        is_tuple_type(MyClass) == True

    For more general tests use issubclass(..., tuple), for more precise test
    (excluding subclasses) use::

        get_origin(tp) is tuple  # Tuple prior to Python 3.7
    """
    return (tp is Tuple or isinstance(tp, _GenericAlias) and
            tp.__origin__ is tuple or
            isinstance(tp, type) and issubclass(tp, Generic) and
            issubclass(tp, tuple))