Moves up in the delegate hierarchy until it finds a container wihout a parent, then returns that container
544673
public function findRootContainer() : DelegateInterface
    {
        $obj = $this;
        while($obj->hasParent() === true) {
            $obj = $obj->getParent();
        }
        return $obj;
    }
164834
def inherit(self, parent):
        """"""
        if self._parent == parent:
            return
        if self._parent:
            self._parent.release_all(self._parent_changed)
        self_values = {key: self._container[key] for key in self._own_keys}
        self._container = {**parent.to_dictionary(), **self_values}
        self._parent = parent
        self._parent.observe_all(self._parent_changed)
110016
function moveStart(rng) {
        var container = rng.startContainer,
          offset = rng.startOffset, isAtEndOfText,
          walker, node, nodes, tmpNode;

        if (rng.startContainer == rng.endContainer) {
          if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
            return;
          }
        }

        // Convert text node into index if possible
        if (container.nodeType == 3 && offset >= container.nodeValue.length) {
          // Get the parent container location and walk from there
          offset = nodeIndex(container);
          container = container.parentNode;
          isAtEndOfText = true;
        }

        // Move startContainer/startOffset in to a suitable node
        if (container.nodeType == 1) {
          nodes = container.childNodes;
          container = nodes[Math.min(offset, nodes.length - 1)];
          walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));

          // If offset is at end of the parent node walk to the next one
          if (offset > nodes.length - 1 || isAtEndOfText) {
            walker.next();
          }

          for (node = walker.current(); node; node = walker.next()) {
            if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
              // IE has a "neat" feature where it moves the start node into the closest element
              // we can avoid this by inserting an element before it and then remove it after we set the selection
              tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
              node.parentNode.insertBefore(tmpNode, node);

              // Set selection and remove tmpNode
              rng.setStart(node, 0);
              selection.setRng(rng);
              dom.remove(tmpNode);

              return;
            }
          }
        }
      }
175068
def get_parent(self, update=False):
        
        depth = int(len(self.path) / self.steplen)
        if depth <= 1:
            return
        try:
            if update:
                del self._cached_parent_obj
            else:
                return self._cached_parent_obj
        except AttributeError:
            pass
        parentpath = self._get_basepath(self.path, depth - 1)
        self._cached_parent_obj = get_result_class(
            self.__class__).objects.get(path=parentpath)
        return self._cached_parent_obj
166074
public static EntityContainer getRootContainer(final EntityContainer container) {
	Objects.requireNonNull(container);

	if (container instanceof Entity) {
	    final EntityContainer parent = ((Entity) container).getContainer();
	    if (parent != null) {
		return getRootContainer(parent);
	    }
	}
	return container;
    }
302438
private void moveClassLevelUp(Outline outline, JDefinedClass clazz) {
		// Modify the container so it now refers the class. Container can be a class or package.
		JDefinedClass parent = (JDefinedClass) clazz.parentContainer();
		JClassContainer grandParent = parent.parentContainer();
		Map<String, JDefinedClass> classes;

		// FIXME: Pending https://java.net/jira/browse/JAXB-957
		if (grandParent.isClass()) {
			// Element class should be added as its container child:
			JDefinedClass grandParentClass = (JDefinedClass) grandParent;

			writeSummary("\tMoving inner class " + clazz.fullName() + " to class " + grandParentClass.fullName());

			classes = getPrivateField(grandParentClass, "classes");
		}
		else {
			JPackage grandParentPackage = (JPackage) grandParent;

			writeSummary("\tMoving inner class " + clazz.fullName() + " to package " + grandParentPackage.name());

			classes = getPrivateField(grandParentPackage, "classes");

			// In this scenario class should have "static" modifier reset otherwise it won't compile:
			setPrivateField(clazz.mods(), "mods", Integer.valueOf(clazz.mods().getValue() & ~JMod.STATIC));

			for (ClassOutline classOutline : outline.getClasses()) {
				if (classOutline.implClass == clazz) {
					XSComponent sc = classOutline.target.getSchemaComponent();

					// FIXME: Inner class is always a local declaration.
					assert (sc instanceof XSDeclaration && ((XSDeclaration) sc).isLocal());

					setPrivateField(sc, "anonymous", Boolean.FALSE);

					break;
				}
			}
		}

		if (classes.containsKey(clazz.name())) {
			writeSummary("\tRenaming class " + clazz.fullName() + " to class " + parent.name() + clazz.name());
			setPrivateField(clazz, "name", parent.name() + clazz.name());
		}

		classes.put(clazz.name(), clazz);

		// Finally modify the class so that it refers back the container:
		setPrivateField(clazz, "outer", grandParent);
	}
390396
function (context, callback, checkParents) {
            if (this.$parentResource) {
                var self = this;
                flow()
                    .seq("parentCollection", function (cb) {
                        self.$parentResource._findCollection(context, cb);
                    })
                    .seq("parent", function (cb) {
                        var parentCollection = this.vars.parentCollection,
                            id = parentCollection.$modelFactory.prototype.convertIdentifier(self.$parentResource.$resourceId),
                            parent = parentCollection.createItem(id);

                        if (checkParents) {
                            parent.fetch(null, cb);
                        } else {
                            cb(null, parent);
                        }
                    })
                    .exec(function (err, results) {
                        if (!err) {
                            var collection = results.parent.getCollection(self.$resourceConfiguration.$.path);
                            callback && callback(null, collection);
                        } else {
                            callback && callback(err);
                        }
                    });
            } else {
                var dataSource = this.$restHandler.getDataSource(context, this);
                callback && callback(null, dataSource.createCollection(Collection.of(this._getModelFactory()), {pageSize: 100}));
            }
        }
1034403
def get_parent(self):
        """"""
        if not self.has_cached_parent:
            if self.parent is not None:
                self._parent_block = self.runtime.get_block(self.parent)
            else:
                self._parent_block = None
            self._parent_block_id = self.parent
        return self._parent_block
292728
function waitForChildCallback (parent, predicate, callback) {
  if (predicate(parent)) {
    callback()

    return
  }

  const win = parent.ownerDocument.defaultView

  if (win.MutationObserver) {
    /**
     * @type {!MutationObserver}
     */
    const observer = new win.MutationObserver(() => {
      if (predicate(parent)) {
        observer.disconnect()
        callback()
      }
    })

    observer.observe(parent, {childList: true})

    return
  }

  const intervalId = win.setInterval(() => {
    if (predicate(parent)) {
      win.clearInterval(intervalId)
      callback()
    }
  }, 5)
}
923759
function(autocrat, governor, origHandler, context) {
    var streamsHash = this.streamsHash,
        handlerSequence, isFirstHandler, deferred, handler;

    context || (context = this.governor);

    if(isFunction(origHandler)) {
      origHandler = bind(origHandler, context);
    } else if(isString(origHandler)){
      origHandler = bind(this.governor[origHandler], context);
    }

    if(autocrat.awaiting[this.streamsHash]) {
      handlerSequence = autocrat.awaiting[this.streamsHash];
    } else {
      handlerSequence = autocrat.awaiting[this.streamsHash] = [];
      isFirstHandler = true;
    }

    deferred = new HandlerDeferred(handlerSequence);
    handler = this._buildAsyncHandler(origHandler, deferred);

    if(isFirstHandler) {
      deferred.handlerIndex = 0;
      handlerSequence.push(handler);
      this.resultStream.subscribe(handler);
    } else {
      deferred.handlerIndex = handlerSequence.length;
      handlerSequence.push(handler);
    }

    // terminate chain
    return this;
  }
511830
@Override
    protected E findNext(){
        while(true){
            E elem = delegate.next();
            if(elem==null || filter.select(elem))
                return elem;
        }
    }
721134
def delegate(self, fn, *args, **kwargs):
        """"""
        return self.subexecutor.spawn(fn, *args, **kwargs)
774109
function findParent(node) {
  // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  // traversal, but caching is difficult to do correctly without using a
  // mutation observer to listen for all DOM changes.
  var nodeID = ReactMount.getID(node);
  var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  var container = ReactMount.findReactContainerForID(rootID);
  var parent = ReactMount.getFirstReactDOM(container);
  return parent;
}
296406
public static void findClassLoaderOrder(final ClassLoader classLoader,
            final ClassLoaderOrder classLoaderOrder) {
        classLoaderOrder.delegateTo(
                (ClassLoader) ReflectionUtils.getFieldVal(classLoader, "parentContextClassLoader", false),
                /* isParent = */ true);
        classLoaderOrder.delegateTo(classLoader.getParent(), /* isParent = */ true);
        classLoaderOrder.add(classLoader);
    }
1232468
@SuppressWarnings("unchecked")
    @Override
    public Layer moveUp()
    {
        final Node<?> parent = getParent();

        if (null != parent)
        {
            final IContainer<?, Layer> container = (IContainer<?, Layer>) parent.asContainer();

            if (null != container)
            {
                container.moveUp(this);
            }
        }
        return this;
    }
651077
def get_obj_in_upper_tree(element, cls):
    """"""
    if not hasattr(element, '_parent'):
        raise ValueError('The top of the tree was reached without finding a {}'
                         .format(cls))
    parent = element._parent
    if not isinstance(parent, cls):
        return get_obj_in_upper_tree(parent, cls)
    return parent
605356
function pushContainer(listKey, nodes) {
  this._assertUnremoved();

  nodes = this._verifyNodeList(nodes);

  // get an invisible path that represents the last node + 1 and replace it with our
  // nodes, effectively inlining it

  var container = this.node[listKey];
  var i = container.length;
  var path = _index2["default"].get({
    parentPath: this,
    parent: this.node,
    container: container,
    listKey: listKey,
    key: i
  });

  return path.replaceWith(nodes, true);
}