Return a list of all <__base_class> based classes found in <file>
508823
def __find_child_classes(self, file):
        

        child_classes = []
        folder, name = os.path.split(file)
        name = os.path.splitext(name)[0]

        import imp
        module = imp.load_source(name, file)

        def filter_classes(m):
            if inspect.isclass(m):
                if inspect.getmro(m)[1] == self.__base_class:
                    return True
            return False

        for name, obj in inspect.getmembers(module, filter_classes):
            child_classes.append(obj)

        return child_classes
1038805
def list_hierarchy(class_name, bases):
    

    class_list = [Uri(class_name)]
    for base in bases:
        if base.__name__ not in IGNORE_CLASSES:
            class_list.append(Uri(base.__name__))
    return list([i for i in set(class_list)])
275292
def metaclasses(bases):
    ''' 
    '''
    ret = []
    metas = [type(base) for base in bases]
    for k,meta in enumerate(metas):
        if not any(issubclass(m, meta) for m in metas[k+1:]):
            ret.append(meta)

    if type in ret:
        ret.remove(type)
    return ret
396005
def _filter_classes(cls_list, cls_type):
    """"""
    for cls in cls_list:
        if isinstance(cls, type) and issubclass(cls, cls_type):
            if cls_type == TempyPlace and cls._base_place:
                pass
            else:
                yield cls
83293
def _get_bases(type_):
        # type: (type) -> Tuple[type, type]
        
        try:

            class _(type_):  # type: ignore
                """Check if type_ is subclassable."""

            BaseClass = type_
        except TypeError:
            BaseClass = object

        class MetaClass(_ValidationMeta, BaseClass.__class__):  # type: ignore
            """Use the type_ meta and include base validation functionality."""

        return BaseClass, MetaClass
374489
def toposort_classes(classes):
    """"""
    def get_class_topolist(class_name, name_to_class, processed_classes, current_trace):
        """Return a topologically sorted list of this class's dependencies and class itself

        Args:
            class_name: string, name of the class to process
            name_to_class: dict, class_name -> descriptor
            processed_classes: set of strings, a set of classes that have already been processed
            current_trace: list of strings, list of classes traversed during the recursion

        Returns:
            list of dicts, list of classes sorted in topological order
        """
        # Check if this class has already been handled
        if class_name in processed_classes:
            return []

        if class_name in current_trace:
            raise AssertionError(
                'Encountered self-reference in dependency chain of {}'.format(class_name))

        cls = name_to_class[class_name]
        # Collect the dependency classes
        # These are bases and classes from linked properties
        dependencies = _list_superclasses(cls)
        # Recursively process linked edges
        properties = cls['properties'] if 'properties' in cls else []
        for prop in properties:
            if 'linkedClass' in prop:
                dependencies.append(prop['linkedClass'])

        class_list = []
        # Recursively process superclasses
        current_trace.add(class_name)
        for dependency in dependencies:
            class_list.extend(get_class_topolist(
                dependency, name_to_class, processed_classes, current_trace))
        current_trace.remove(class_name)
        # Do the bookkeeping
        class_list.append(name_to_class[class_name])
        processed_classes.add(class_name)

        return class_list

    # Map names to classes
    class_map = {c['name']: c for c in classes}
    seen_classes = set()

    toposorted = []
    for name in class_map.keys():
        toposorted.extend(get_class_topolist(name, class_map, seen_classes, set()))
    return toposorted
277471
def all_subclasses(cls):
    """"""
    for s in cls.__subclasses__():
      yield s
      for c in s.all_subclasses():
        yield c
170915
def get_classes_in_module(module, superclass=object):
    

    ret = []
    for classname in dir(module):
        attr = module.__getattribute__(classname)
        try:
            if issubclass(attr, superclass) and (attr != superclass):
                ret.append(attr)
        except TypeError:
            # "issubclass() arg 1 must be a class"
            pass
        except RuntimeError:
            # a99.get_python_logger().exception("Failed probing attribute '{}'".format(classname))
            # raise
            pass
    return ret
182872
def find_base_images(self):
        """"""

        for mountpoint, _ in self.mountpoints.items():
            if re.match(self.orig_re_pattern, mountpoint):
                yield mountpoint
557721
def GetClassesByArtifact(cls, artifact_name):
    """"""
    return [
        cls.classes[c]
        for c in cls.classes
        if artifact_name in cls.classes[c].supported_artifacts
    ]
522329
def _subclassed(base, *classes):
        
        return all(map(lambda obj: isinstance(obj, base), classes))
277761
function class_list() {
  skip_horiz_white();
  classes = [];
  while (look(ident_chain_pattern)) {
    classes.push(ident_chain());
    skip_horiz_white();
  }
  
  return classes;
}
319500
def all_bases (type):
    
    assert isinstance(type, basestring)
    result = []
    while type:
        result.append (type)
        type = __types [type]['base']

    return result
546573
def match(Class, path, pattern, flags=re.I, sortkey=None, ext=None):
        """"""
        return sorted(
            [
                Class(fn=fn)
                for fn in rglob(path, f"*{ext or ''}")
                if re.search(pattern, os.path.basename(fn), flags=flags) is not None
                and os.path.basename(fn)[0] != '~'  # omit temp files
            ],
            key=sortkey,
        )
1143873
def find(cls, paths):
    
    pythons = []
    for path in paths:
      for fn in cls.expand_path(path):
        basefile = os.path.basename(fn)
        if cls._matches_binary_name(basefile):
          try:
            pythons.append(cls.from_binary(fn))
          except Exception as e:
            TRACER.log('Could not identify %s: %s' % (fn, e))
            continue
    return pythons
1238681
def get_superclasses_from_class_definition(class_definition):
    """"""
    # New-style superclasses definition, supporting multiple-inheritance.
    superclasses = class_definition.get('superClasses', None)

    if superclasses:
        return list(superclasses)

    # Old-style superclass definition, single inheritance only.
    superclass = class_definition.get('superClass', None)
    if superclass:
        return [superclass]

    # No superclasses are present.
    return []
979601
def classes(self) -> Iterator[str]:
        """"""
        yield from (
            c[:-6]
            for c in self.path_map.keys() if c.endswith('.class')
        )