extend_parents(parents)

    Returns a set containing
    nearest conditionally stochastic (Stochastic, not Deterministic) ancestors.
971838
def extend_parents(parents):
    
    new_parents = set()

    for parent in parents:

        new_parents.add(parent)

        if isinstance(parent, DeterministicBase):
            new_parents.remove(parent)
            new_parents |= parent.extended_parents

        elif isinstance(parent, ContainerBase):
            for contained_parent in parent.stochastics:
                new_parents.add(contained_parent)
            for contained_parent in parent.deterministics:
                new_parents |= contained_parent.extended_parents

    return new_parents
599441
function() {
			var i,
				l,
				parents = this.getParentList(false, false);

			for (i = 0, l = parents.length; i < l; i++) {
				if (!parents[i].expanded) {
					return false;
				}
			}
			return true;
		}
224211
def parents(self):
        
        entries = []
        command = self
        while command.parent is not None:
            command = command.parent
            entries.append(command)

        return entries
596075
def get_ancestors(self):
        ""

        if self._ancestors:
            return self._ancestors

        if not self.parent:
            return []

        obj = self.resource_map.get(self.parent.uid)

        while obj and obj.member_name:
            self._ancestors.append(obj)
            obj = obj.parent

        self._ancestors.reverse()
        return self._ancestors
631278
def _ancestors(collection):
    """"""
    for index, c in enumerate(collection.path_to_root()):
        if index > 0 and c.dbquery is not None:
            raise StopIteration
        yield c.name
    raise StopIteration
159864
def node_ancestor(node, levels)
      while levels > 0
        node = node.node_parent
        return unless node
        levels -= 1
      end

      node
    end
1210019
def get_proxy_ancestor_classes(klass):
    
    proxy_ancestor_classes = set()
    for superclass in klass.__bases__:
        if hasattr(superclass, '_meta') and superclass._meta.proxy:
            proxy_ancestor_classes.add(superclass)
        proxy_ancestor_classes.update(
            get_proxy_ancestor_classes(superclass))
    return proxy_ancestor_classes
37566
def descendants(include_singletons = false)
      return _inherited_by.map { |c| [c, c.descendants] }.flatten.uniq if BBLib.in_opal?
      ObjectSpace.each_object(Class).select do |c|
        (include_singletons || !c.singleton_class?) && c < self
      end
    end
128117
def ancestors(self, cl=None, noduplicates=True):
        
        if not cl:
            cl = self
        if cl.parents():
            bag = []
            for x in cl.parents():
                if x.uri != cl.uri:  # avoid circular relationships
                    bag += [x] + self.ancestors(x, noduplicates)
                else:
                    bag += [x]
            # finally:
            if noduplicates:
                return remove_duplicates(bag)
            else:
                return bag
        else:
            return []
296792
def get_ancestor_list(n)
      raise ArgumentError, "n must be greater or equal than zero" unless n >= 0

      return [] if n == 0 || number == 0
      parent = get_parent
      [parent] + parent.get_ancestor_list(n-1)
    end
305922
def get_parents_for(self, child_ids):
        
        self._cache_init()
        parent_candidates = []
        for parent, children in self._cache_get_entry(self.CACHE_NAME_PARENTS).items():
            if set(children).intersection(child_ids):
                parent_candidates.append(parent)
        return set(parent_candidates)
1037416
function parents() {
                var parent = void 0,
                    path = [];

                while (!!(parent = el.parentNode)) {
                    path.push(parent);
                    el = parent;
                }

                return path;
            }
1151826
def ancestor(qobject, classType):
    
    parent = qobject
    is_class = True
    while parent:
        if type(parent).__name__ == classType:
            return parent
        
        if is_class:
            try:
                if isinstance(parent, classType):
                    return parent
            except TypeError:
                is_class = False
        
        parent = parent.parent()
    
    return None
937811
def get_ancestor_processes():
    """"""
    if not _ANCESTOR_PROCESSES and psutil is not None:
        proc = psutil.Process(os.getpid())
        while proc.parent() is not None:
            try:
                _ANCESTOR_PROCESSES.append(proc.parent().exe())
                proc = proc.parent()
            except psutil.Error:
                break
    return _ANCESTOR_PROCESSES
312357
def find_generations(container, with_data=False):
    

    generations = []

    # Find root generation
    generations.append(set())
    all_children = set()
    if with_data:
        stochastics_to_iterate = container.stochastics | container.observed_stochastics
    else:
        stochastics_to_iterate = container.stochastics
    for s in stochastics_to_iterate:
        all_children.update(s.extended_children & stochastics_to_iterate)
    generations[0] = stochastics_to_iterate - all_children

    # Find subsequent _generations
    children_remaining = True
    gen_num = 0
    while children_remaining:
        gen_num += 1

        # Find children of last generation
        generations.append(set())
        for s in generations[gen_num - 1]:
            generations[gen_num].update(
                s.extended_children & stochastics_to_iterate)

        # Take away stochastics that have parents in the current generation.
        thisgen_children = set()
        for s in generations[gen_num]:
            thisgen_children.update(
                s.extended_children & stochastics_to_iterate)
        generations[gen_num] -= thisgen_children

        # Stop when no subsequent _generations remain
        if len(thisgen_children) == 0:
            children_remaining = False
    return generations
1176646
def ancestors(self, stop=None):
        
        folder = self
        while folder.parent != stop:
            if folder.parent == folder:
                return
            yield folder.parent
            folder = folder.parent
940039
def ancestors
      node  = self
      nodes = []
      nodes << node = node.parent while node.parent
      nodes
    end