Used by subclasses
550431
final protected Collection common_values() {
        //TODO: make efficient
        ArrayList<Object> al = new ArrayList<Object>();
        Enumeration vEnum = cache.getAllIds();
        while (vEnum.hasMoreElements())
            al.add(get(vEnum.nextElement()));
        return al;
    }
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
560828
def is_handler_subclass(cls, classnames=("ViewHandler", "APIHandler")):
    """"""
    if isinstance(cls, list):
        return any(is_handler_subclass(c) for c in cls)
    elif isinstance(cls, type):
        return any(c.__name__ in classnames for c in inspect.getmro(cls))
    else:
        raise TypeError(
            "Unexpected type `{}` for class `{}`".format(
                type(cls),
                cls
            )
        )
1202855
def is_subclass(obj, cls):
    
    try:
        for i in obj.__bases__:
            if i is cls or isinstance(i, cls):
                return True
        for i in obj.__bases__:
            if isinstance(i, cls):
                return True
    except AttributeError:
        return isinstance(obj.__class__, cls)
    return False
479346
protected function _loadSubClasses(): void
	{
		// Load the sql and util class for the driver
		$thisClass = \get_class($this);
		$nsArray = explode("\\", $thisClass);
		array_pop($nsArray);
		$driver = array_pop($nsArray);
		$sqlClass = __NAMESPACE__ . "\\{$driver}\\SQL";
		$utilClass = __NAMESPACE__ . "\\{$driver}\\Util";

		$this->sql = new $sqlClass();
		$this->util = new $utilClass($this);
	}
1087371
private void loadAllInstances(ZooClassProxy def, boolean subClasses, 
			MergingIterator<ZooPC> iter, boolean loadFromCache) {
		for (Node n: nodes) {
			iter.add(n.loadAllInstances(def, loadFromCache));
		}
		
		if (subClasses) {
			for (ZooClassProxy sub: def.getSubProxies()) {
				loadAllInstances(sub, true, iter, loadFromCache);
			}
		}
	}
974979
def walk_subclasses(root):
    """"""
    classes = [root]
    visited = set()
    while classes:
        cls = classes.pop()
        if cls is type or cls in visited:
            continue
        classes.extend(cls.__subclasses__())
        visited.add(cls)
        if cls is not root:
            yield cls
610613
private Collection<TypeElement> subinterfaces(TypeElement te) {
        Collection<TypeElement> ret = classToSubinterface.get(te);
        if (ret == null) {
            ret = new TreeSet<>(utils.makeClassUseComparator());
            Set<TypeElement> subs = classtree.subInterfaces(te);
            if (subs != null) {
                ret.addAll(subs);
                for (TypeElement sub : subs) {
                    ret.addAll(subinterfaces(sub));
                }
            }
            addAll(classToSubinterface, te, ret);
        }
        return ret;
    }
322339
private void addSubType(FunctionType subType) {
    if (subTypes == null) {
      subTypes = new ArrayList<>();
    }
    subTypes.add(subType);
  }
719708
def _make_subclasshook(cls):
    
    if isinstance(cls.__extra__, abc.ABCMeta):
        # The logic mirrors that of ABCMeta.__subclasscheck__.
        # Registered classes need not be checked here because
        # cls and its extra share the same _abc_registry.
        def __extrahook__(subclass):
            res = cls.__extra__.__subclasshook__(subclass)
            if res is not NotImplemented:
                return res
            if cls.__extra__ in subclass.__mro__:
                return True
            for scls in cls.__extra__.__subclasses__():
                if isinstance(scls, GenericMeta):
                    continue
                if issubclass(subclass, scls):
                    return True
            return NotImplemented
    else:
        # For non-ABC extras we'll just call issubclass().
        def __extrahook__(subclass):
            if cls.__extra__ and issubclass(subclass, cls.__extra__):
                return True
            return NotImplemented
    return __extrahook__
481572
public static void visitClassHierarchy(ClassVisitor visitor, Class<?> subClass) {
        Class<?> visitedClass = subClass;
        while (visitedClass.getSuperclass() != null) {
            visitor.visit(visitedClass);
            visitedClass = visitedClass.getSuperclass();
        }
    }
1373731
function detect_class_members_from_array(cls, ast) {
  cls["members"] = [];
  return _.each(ast["elements"], function(el) {
    detect_method_or_property(cls, key_value(el), el, el);
  });
}
463956
def _flatten_subclass_tree(cls):
    
    subclasses = frozenset(cls.__subclasses__())
    children = frozenset(toolz.concat(map(_flatten_subclass_tree, subclasses)))
    return frozenset({cls}) | subclasses | children
1324151
def _subclass(self, parser):
        '''
         
        '''
        _set(self, '_sub', parser._create(memoryview(getattr(self, '_extra', b'')), self._target))
        try:
            object.__delattr__(self, '_extra')
        except:
            pass
1352431
def _issubclass_2(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
    
    if is_Tuple(superclass):
        return _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check)
    if is_Union(superclass):
        return _issubclass_Union(subclass, superclass, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check)
    if is_Union(subclass):
        return all(_issubclass(t, superclass, bound_Generic, bound_typevars,
                bound_typevars_readonly, follow_fwd_refs, _recursion_check) \
                for t in get_Union_params(subclass))
    if is_Generic(superclass):
        cls = superclass.__origin__ if not superclass.__origin__ is None else superclass
        # We would rather use issubclass(superclass.__origin__, Mapping), but that's somehow erroneous
        if pytypes.covariant_Mapping and (_has_base(cls, Mapping) or
                    # Python 3.7 maps everything to collections.abc:
                    (cls in _extra_dict and issubclass(cls, collections.abc.Mapping))):
            return _issubclass_Mapping_covariant(subclass, superclass,
                    bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs,
                    _recursion_check)
        else:
            return _issubclass_Generic(subclass, superclass, bound_Generic, bound_typevars,
                    bound_typevars_readonly, follow_fwd_refs, _recursion_check)
    if subclass in _extra_dict:
        subclass = _extra_dict[subclass]
    try:
        return issubclass(subclass, superclass)
    except TypeError:
        if not is_Type(subclass):
            # For Python 3.7, types from typing are not types.
            # So issubclass emits TypeError: issubclass() arg 1 must be a class
            raise TypeError("Invalid type declaration: %s, %s" %
                        (type_str(subclass), type_str(superclass)))
        return False
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)))
522329
def _subclassed(base, *classes):
        
        return all(map(lambda obj: isinstance(obj, base), classes))