Helper for _issubclass, a.k.a pytypes.issubtype.
760445
def _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
    
    # this function is partly based on code from typing module 3.5.2.2
    if subclass in _extra_dict:
        subclass = _extra_dict[subclass]
    if not is_Type(subclass):
        # To TypeError.
        return False
    if not is_Tuple(subclass):
        if is_Generic(subclass):
            try:
                return _issubclass_Generic(subclass, superclass,
                        bound_Generic, bound_typevars,
                        bound_typevars_readonly, follow_fwd_refs,
                        _recursion_check)
            except:
                pass
        elif is_Union(subclass):
            return all(_issubclass_Tuple(t, superclass, bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs, _recursion_check)
                    for t in get_Union_params(subclass))
        else:
            return False
    super_args = get_Tuple_params(superclass)
    if super_args is None:
        return True
    sub_args = get_Tuple_params(subclass)
    if sub_args is None:
        return False  # ???
    # Covariance.
    # For now we check ellipsis in most explicit manner.
    # Todo: Compactify and Pythonify ellipsis branches (tests required before this).
    if is_Tuple_ellipsis(subclass):
        if is_Tuple_ellipsis(superclass):
            # both are ellipsis, so no length check
            common = min(len(super_args), len(sub_args))
            for i in range(common):
                if not _issubclass(sub_args[i], super_args[i], bound_Generic, bound_typevars,
                        bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                    return False
            if len(super_args) < len(sub_args):
                for i in range(len(super_args), len(sub_args)):
                    # Check remaining super args against the ellipsis type
                    if not _issubclass(sub_args[i], super_args[-1], bound_Generic, bound_typevars,
                            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                        return False
            elif len(super_args) > len(sub_args):
                for i in range(len(sub_args), len(super_args)):
                    # Check remaining super args against the ellipsis type
                    if not _issubclass(sub_args[-1], super_args[i], bound_Generic, bound_typevars,
                            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                        return False
            return True
        else:
            # only subclass has ellipsis
            if len(super_args) < len(sub_args)-1:
                return False
            for i in range(len(sub_args)-1):
                if not _issubclass(sub_args[i], super_args[i], bound_Generic, bound_typevars,
                        bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                    return False
            for i in range(len(sub_args), len(super_args)):
                # Check remaining super args against the ellipsis type
                if not _issubclass(sub_args[-1], super_args[i], bound_Generic, bound_typevars,
                        bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                    return False
            return True
    elif is_Tuple_ellipsis(superclass):
        # only superclass has ellipsis
        if len(super_args)-1 > len(sub_args):
            return False
        for i in range(len(super_args)-1):
            if not _issubclass(sub_args[i], super_args[i], bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                return False
        for i in range(len(super_args), len(sub_args)):
            # Check remaining sub args against the ellipsis type
            if not _issubclass(sub_args[i], super_args[-1], bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                return False
        return True
    else:
        # none has ellipsis, so strict length check
        return (len(super_args) == len(sub_args) and
                all(_issubclass(x, p, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check)
                for x, p in zip(sub_args, super_args)))
628151
def lookup_subclass(cls, d):
        
        try:
            typeid = d["typeid"]
        except KeyError:
            raise FieldError("typeid not present in keys %s" % list(d))

        subclass = cls._subcls_lookup.get(typeid, None)
        if not subclass:
            raise FieldError("'%s' not a valid typeid" % typeid)
        else:
            return subclass
1054769
def is_model_admin_subclass(node):
    """"""
    if node.name[-5:] != 'Admin' or isinstance(node.parent, ClassDef):
        return False

    return node_is_subclass(node, 'django.contrib.admin.options.ModelAdmin')
1215553
def check_input(self, obj):
        
        if isinstance(obj, str):
            return
        if isinstance(obj, unicode):
            return
        raise Exception("Unsupported class: " + self._input.__class__.__name__)
1215698
def is_iterable(etype) -> bool:
    
    return type(etype) is GenericMeta and issubclass(etype.__extra__, Iterable)
1257508
def register_subclass(cls, typeid):
        
        def decorator(subclass):
            cls._subcls_lookup[typeid] = subclass
            subclass.typeid = typeid
            return subclass
        return decorator
640100
def all_subclasses(cls):
    
    subclasses = cls.__subclasses__() 
    return subclasses + [g for s in subclasses for g in all_subclasses(s)]
978981
def is_backup_class(cls):
    """"""
    return True if (
        isclass(cls) and
        issubclass(cls, Storable) and
        get_mapping(cls, no_mapping_ok=True)
    ) else False
1335231
def is_class_or_module(self):
        

        if isinstance(self.obj, ObjectDouble):
            return self.obj.is_class

        return isclass(self.doubled_obj) or ismodule(self.doubled_obj)
1120951
function isNumericSubclass( t, t_min, t_max, of_t ) {
	if ((t === NUMTYPE.NAN) || (of_t === NUMTYPE.NAN)) return false;
	switch (of_t) { // Parent
		case NUMTYPE.UINT8:
			switch (t) {
				case NUMTYPE.UINT8:
					return true;
				case NUMTYPE.INT8:
					return (t_min > 0);
				default:
					return false;
			}

		case NUMTYPE.INT8:
			switch (t) {
				case NUMTYPE.UINT8:
					return (t_max < INT8_MAX);
				case NUMTYPE.INT8:
					return true;
				default:
					return false;
			}

		case NUMTYPE.UINT16:
			switch (t) {
				case NUMTYPE.UINT8:
				case NUMTYPE.UINT16:
					return true;
				case NUMTYPE.INT8:
				case NUMTYPE.INT16:
					return (t_min > 0);
				default:
					return false;
			}

		case NUMTYPE.INT16:
			switch (t) {
				case NUMTYPE.UINT8:
				case NUMTYPE.INT8:
				case NUMTYPE.INT16:
					return true;
				case NUMTYPE.UINT16:
					return (t_max < INT16_MAX);
				default:
					return false;
			}

		case NUMTYPE.UINT32:
			switch (t) {
				case NUMTYPE.UINT8:
				case NUMTYPE.UINT16:
				case NUMTYPE.UINT32:
					return true;
				case NUMTYPE.INT8:
				case NUMTYPE.INT16:
				case NUMTYPE.INT32:
					return (t_min > 0);
				default:
					return false;
			}

		case NUMTYPE.INT32:
			switch (t) {
				case NUMTYPE.UINT8:
				case NUMTYPE.INT8:
				case NUMTYPE.UINT16:
				case NUMTYPE.INT16:
				case NUMTYPE.INT32:
					return true;
				case NUMTYPE.UINT32:
					return (t_max < INT32_MAX);
				default:
					return false;
			}

		case NUMTYPE.FLOAT32:
			switch (t) {
				case NUMTYPE.UINT8:
				case NUMTYPE.INT8:
				case NUMTYPE.UINT16:
				case NUMTYPE.INT16:
				case NUMTYPE.FLOAT32:
					return true;
				case NUMTYPE.UINT32:
				case NUMTYPE.INT32:
					return (t_min > FLOAT32_NEG) && (t_max < FLOAT32_POS);
				default:
					return false;
			}

		case NUMTYPE.FLOAT64:
			return true;

	}
	return false;
}
56413
def class_check(vector):
    
    for i in vector:
        if not isinstance(i, type(vector[0])):
            return False
    return True
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)
1240512
def is_int_dtype(dtype):
    """"""
    dtype = np.dtype(dtype)
    return np.issubsctype(getattr(dtype, 'base', None), np.integer)
675260
def _can_hold_element(self, element):
        
        dtype = self.values.dtype.type
        tipo = maybe_infer_dtype_type(element)
        if tipo is not None:
            return issubclass(tipo.type, dtype)
        return isinstance(element, dtype)
1145477
def _is_possible_subclass(self, subtype, supertype):
        
        subparams = getattr(subtype, "__parameters__", None)
        if subparams is None:
            return issubclass(subtype, supertype)  # a non-generic actual type
        # It is surprisingly difficult to ignore the type variables in a
        # subclass check. We therefore compare __name__ (along mro) only.
        # This can produce false positives in principle.
        # (previous "nullify __parameters__" logic deleted 2016-01-24 14:52)
        for subtype_super in subtype.mro():
            if subtype_super.__name__ == supertype.__name__:
                # squeeze your thumbs this is not just by accident
                return True  # TODO: ensure __parameters__ are compatible
        return False
1141359
def is_strict_subclass (value, klass):
    
    return (isinstance (value, type) and
            issubclass (value, klass) and
            value is not klass)
703450
def ensure_subclass(value, types):
    
    ensure_class(value)
    if not issubclass(value, types):
        raise TypeError(
            "expected subclass of {}, not {}".format(
                types, value))