def _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
    """Helper for _issubclass_Union.
    """
    # this function is partly based on code from typing module 3.5.2.2
    super_args = get_Union_params(superclass)
    if super_args is None:
        return is_Union(subclass)
    elif is_Union(subclass):
        sub_args = get_Union_params(subclass)
        if sub_args is None:
            return False
        return all(_issubclass(c, superclass, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check) \
                for c in (sub_args))
    elif isinstance(subclass, TypeVar):
        if subclass in super_args:
            return True
        if subclass.__constraints__:
            return _issubclass(Union[subclass.__constraints__],
                    superclass, bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs, _recursion_check)
        return False
    else:
        return any(_issubclass(subclass, t, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check) \
                for t in super_args)
def _issubclass_Union_rec ( subclass , superclass , bound_Generic , bound_typevars , bound_typevars_readonly , follow_fwd_refs , _recursion_check ) : super_args = get_Union_params ( superclass ) if super_args is None : return is_Union ( subclass ) elif is_Union ( subclass ) : sub_args = get_Union_params ( subclass ) if sub_args is None : return False return all ( _issubclass ( c , superclass , bound_Generic , bound_typevars , bound_typevars_readonly , follow_fwd_refs , _recursion_check ) for c in ( sub_args ) ) elif isinstance ( subclass , TypeVar ) : if subclass in super_args : return True if subclass . __constraints__ : return _issubclass ( Union [ subclass . __constraints__ ] , superclass , bound_Generic , bound_typevars , bound_typevars_readonly , follow_fwd_refs , _recursion_check ) return False else : return any ( _issubclass ( subclass , t , bound_Generic , bound_typevars , bound_typevars_readonly , follow_fwd_refs , _recursion_check ) for t in super_args )
Helper for _issubclass_Union.