From a list of top level trees, return the list of contained class definitions
46
List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
        List<JCClassDecl> result = new ArrayList<>();
        for (JCCompilationUnit t : trees) {
            for (JCTree def : t.defs) {
                if (def.hasTag(JCTree.Tag.CLASSDEF))
                    result.add((JCClassDecl)def);
            }
        }
        return result;
    }
5838
def _get_columns(self):
        
        return [self] + [c for c in self.children
                         if isinstance(c, TreeViewColumn)]
774683
def get_all_rooted_subtrees_as_lists(self, start_location=None):
        """"""
        if start_location is not None and start_location not in self._location_to_children:
            raise AssertionError(u'Received invalid start_location {} that was not present '
                                 u'in the tree. Present root locations of complex @optional '
                                 u'queries (ones that expand vertex fields within) are: {}'
                                 .format(start_location, self._location_to_children.keys()))

        if start_location is None:
            start_location = self._root_location

        if len(self._location_to_children[start_location]) == 0:
            # Node with no children only returns a singleton list containing the null set.
            return [[]]

        current_children = sorted(self._location_to_children[start_location])

        # Recursively find all rooted subtrees of each of the children of the current node.
        location_to_list_of_subtrees = {
            location: list(self.get_all_rooted_subtrees_as_lists(location))
            for location in current_children
        }

        # All subsets of direct child Location objects
        all_location_subsets = [
            list(subset)
            for subset in itertools.chain(*[
                itertools.combinations(current_children, x)
                for x in range(0, len(current_children) + 1)
            ])
        ]

        # For every possible subset of the children, and every combination of the chosen
        # subtrees within, create a list of subtree Location lists.
        new_subtrees_as_lists = []
        for location_subset in all_location_subsets:
            all_child_subtree_possibilities = [
                location_to_list_of_subtrees[location]
                for location in location_subset
            ]
            all_child_subtree_combinations = itertools.product(*all_child_subtree_possibilities)

            for child_subtree_combination in all_child_subtree_combinations:
                merged_child_subtree_combination = list(itertools.chain(*child_subtree_combination))
                new_subtree_as_list = location_subset + merged_child_subtree_combination
                new_subtrees_as_lists.append(new_subtree_as_list)

        return new_subtrees_as_lists
304614
<T extends JCTree> List<Type> classEnter(List<T> trees, Env<AttrContext> env) {
        ListBuffer<Type> ts = new ListBuffer<>();
        for (List<T> l = trees; l.nonEmpty(); l = l.tail) {
            Type t = classEnter(l.head, env);
            if (t != null)
                ts.append(t);
        }
        return ts.toList();
    }
1342767
def _get_members(o):
    
    result = []
    for n in dir(o):
        if hasattr(o, n) and n not in ["__globals__", "func_globals"]:
            result.append((n, getattr(o, n)))
    return result
255429
def get_child_types(tree):
    
    child_types = defaultdict(list)
    for i, child in enumerate(tree):
        child_types[get_tree_type(child)].append(i)
    return child_types
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
850225
def get_class_methods(cls):
    
    return [
        node
        for node in cls.body
        if isinstance(node, ast.FunctionDef)
    ]
643521
private Collection<TypeElement> subclasses(TypeElement te) {
        Collection<TypeElement> ret = classToSubclass.get(te);
        if (ret == null) {
            ret = new TreeSet<>(utils.makeClassUseComparator());
            Set<TypeElement> subs = classtree.subClasses(te);
            if (subs != null) {
                ret.addAll(subs);
                for (TypeElement sub : subs) {
                    ret.addAll(subclasses(sub));
                }
            }
            addAll(classToSubclass, te, ret);
        }
        return ret;
    }
253034
def members(self):
        
        return list(
            [
                self.children_class(child)
                for child in self.graph.subjects(RDF_NAMESPACES.DTS.parent, self.asNode())
            ]
        )
476621
def _get_classes_to_inspect(self):
        
        return tuple(filter(lambda c:
                      SerializableMixIn._get_version(c, require=False) or
                      (SerializableMixIn._get_serialize_fields(c) or
                       SerializableMixIn._get_interpolation_map(c)),
                      self.__class__.__mro__))
1163050
private List<ClassDocImpl> getClasses(boolean filtered) {
        if (allClasses != null && !filtered) {
            return allClasses;
        }
        if (allClassesFiltered != null && filtered) {
            return allClassesFiltered;
        }
        ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
        for (Symbol enumerated : sym.members().getSymbols(NON_RECURSIVE)) {
            if (enumerated != null) {
                ClassSymbol s = (ClassSymbol)enumerated;
                ClassDocImpl c = env.getClassDoc(s);
                if (c != null && !c.isSynthetic())
                    c.addAllClasses(classes, filtered);
            }
        }
        if (filtered)
            return allClassesFiltered = classes.toList();
        else
            return allClasses = classes.toList();
    }
941787
def get_tree_members(self):
        

        members = []
        queue = deque()
        queue.appendleft(self)
        visited = set()

        while len(queue):
            node = queue.popleft()

            if node not in visited:
                members.extend(node.get_member_info())
                queue.extendleft(node.get_children())
                visited.add(node)

        return [{attribute: member.get(attribute) for attribute in self.attr_list} for member in members if member]
676108
def get_reader_classes(parent=Reader):
    """"""
    children = parent.__subclasses__()
    descendants = children[:]
    for child in children:
        grandchildren = get_reader_classes(child)
        if grandchildren:
            descendants.remove(child)
            descendants.extend(grandchildren)
    return descendants
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
447000
def _iter_rawterms(cls, tree):
        
        for elem in tree.iterfind(OWL_CLASS):
            if RDF_ABOUT not in elem.keys():   # This avoids parsing a class
                continue                       # created by restriction
            rawterm = cls._extract_resources(elem)
            rawterm['id'] = cls._get_id_from_url(elem.get(RDF_ABOUT))
            yield rawterm
455082
def get_recursive_subclasses(cls):
    """"""
    return cls.__subclasses__() + [g for s in cls.__subclasses__() for g in get_recursive_subclasses(s)]