Test if the type is a union type. Examples::

        is_union_type(int) == False
        is_union_type(Union) == True
        is_union_type(Union[int, int]) == False
        is_union_type(Union[T, int]) == True
184754
def is_union_type(tp):
    
    if NEW_TYPING:
        return (tp is Union or
                isinstance(tp, _GenericAlias) and tp.__origin__ is Union)
    return type(tp) is _Union
1171605
function isType(o, typeName) {
        if (!o || !_.isObject(o)) {
            return false;
        }
        try {
            return Tinkerpop.Java.instanceOf(o, typeName);
        }
        catch (err) {
            return false;
        }
    }
507648
def _is_unit(rule):
    # type: (Type[Rule]) -> bool
    
    return len(rule.left) == 1 and len(rule.right) == 1 and \
           isclass(rule.fromSymbol) and isclass(rule.toSymbol) and \
           issubclass(rule.fromSymbol, Nonterminal) and issubclass(rule.toSymbol, Nonterminal)
755360
static boolean isUnaryOperatorType(Token type) {
    switch (type) {
      case DELPROP:
      case VOID:
      case TYPEOF:
      case POS:
      case NEG:
      case BITNOT:
      case NOT:
        return true;

      default:
        return false;
    }
  }
1324438
def is_sqlatype_numeric(coltype: Union[TypeEngine, VisitableType]) -> bool:
    
    coltype = _coltype_to_typeengine(coltype)
    return isinstance(coltype, sqltypes.Numeric)
1019147
def TYPE(type_):
        
        if isinstance(type_, symbols.TYPE):
            return type_

        assert TYPE.is_valid(type_)
        return gl.SYMBOL_TABLE.basic_types[type_]
1208328
def check_union(data: typing.Union, hint: type) -> bool:
    
    r = any(check_type(data, t)[1] for t in hint.__union_params__)
    if not r:
        raise TypeError(
            'expected one of {0!r}, found: {1!r}'.format(
                hint.__union_params__, type(data)
            )
        )
    return hint, r
419806
def is_type(value):
        """"""
        if isinstance(value, type):
            return issubclass(value, Type)
        return isinstance(value, Type)
1044532
def is_elementary_type(elem_type):
        
        if not oh.is_type(elem_type, bt.XmrType):
            return False
        if oh.is_type(elem_type, (bt.UVarintType, bt.IntType, mt.UnicodeType)):
            return True
        return False
1077078
def is_object_type(type_):
    

    object_types = _get_types(Types.OBJECT)
    if is_typing_type(type_):
        return type_ in object_types or (
            hasattr(type_, "__origin__") and type_.__origin__ in object_types
        )
    return type_ in object_types
861542
def can_convert(strict: bool, from_type: Type[S], to_type: Type[T]):
    
    if (to_type is not None) and (to_type not in (all_primitive_types + all_np_primitive_types)):
        return False
    else:
        return True
1262378
static boolean isSimpleOperatorType(Token type) {
    switch (type) {
      case ADD:
      case BITAND:
      case BITNOT:
      case BITOR:
      case BITXOR:
      case COMMA:
      case DIV:
      case EQ:
      case EXPONENT:
      case GE:
      case GETELEM:
      case GETPROP:
      case GT:
      case IN:
      case INSTANCEOF:
      case LE:
      case LSH:
      case LT:
      case MOD:
      case MUL:
      case NE:
      case NOT:
      case RSH:
      case SHEQ:
      case SHNE:
      case SUB:
      case TYPEOF:
      case VOID:
      case POS:
      case NEG:
      case URSH:
        return true;

      default:
        return false;
    }
  }
885269
def is_tuple(type_: Type[Any]) -> bool:
    '''
    
    '''
    if HAS_TUPLEARGS:
        # The tuple, Tuple thing is a difference between 3.6 and 3.7
        # In 3.6 and before, Tuple had an __extra__ field, while Tuple[something]
        # would have the normal __origin__ field.
        #
        # Those apply for Dict, List, Set, Tuple
        return _generic_type_check(type_, tuple, Tuple)
    else:
        # Old python
        return _issubclass(type_, Tuple) and _issubclass(type_, tuple) == False
166438
protected function checkThisIsSubsetOf(IType $type) : bool
    {
        if ($type instanceof MixedType) {
            return true;
        } elseif ($type instanceof UnionType) {
            if ( $type->hasUnionedType($this)) {
                return true;
            }

            foreach ($type->getTypes() as $type) {
                if ($this->isSubsetOf($type)) {
                    return true;
                }
            }

            return false;
        } elseif ($type instanceof NotType) {
            return !$type->getType()->isSubsetOf($this);
        } else {
            return false;
        }
    }
421013
def _get_union_type_name(type_names_to_union):
    """"""
    if not type_names_to_union:
        raise AssertionError(u'Expected a non-empty list of type names to union, received: '
                             u'{}'.format(type_names_to_union))
    return u'Union__' + u'__'.join(sorted(type_names_to_union))
1086451
def _is_type(self, instance, type):
        
        if type not in self._types:
            raise UnknownType(type)
        type = self._types[type]

        # bool inherits from int, so ensure bools aren't reported as integers
        if isinstance(instance, bool):
            type = _flatten(type)
            if int in type and bool not in type:
                return False
        return isinstance(instance, type)
1088304
def _is_valid_datatype(datatype_instance):
    

    # Remap so we can still use the python types for the simple cases
    global _simple_type_remap
    if datatype_instance in _simple_type_remap:
        return True

    # Now set the protobuf from this interface.
    if isinstance(datatype_instance, (Int64, Double, String, Array)):
        return True

    elif isinstance(datatype_instance, Dictionary):
        kt = datatype_instance.key_type

        if isinstance(kt, (Int64, String)):
            return True

    return False