If this is the root item, return the parent
            which must be a TreeView, otherwise return the
            parent Item's view.
489377
def _default_view(self):
        
        parent = self.parent()
        if isinstance(parent, QtTreeView):
            return parent
        return parent.view
738517
def root(self):
        
        ret = self
        while hasattr(ret, 'parent') and ret.parent:
            ret = ret.parent
        return ret if isinstance(ret, SchemaABC) else None
438057
def RootNode(self):
        """"""
        tree = self.loader.get_root( self.viewType )
        adapter = self.loader.get_adapter( self.viewType )
        rows = self.loader.get_rows( self.viewType )
        
        adapter.SetPercentage(self.percentageView, adapter.value( tree ))
        
        return adapter, tree, rows
64272
def child(self, child):
        
        if isinstance(self, This) or isinstance(self, Root):
            return child
        elif isinstance(child, This):
            return self
        elif isinstance(child, Root):
            return child
        else:
            return Child(self, child)
1072143
public static <T> T root(TreeDef.Parented<T> treeDef, T node) {
		T lastParent;
		T parent = node;
		do {
			lastParent = parent;
			parent = treeDef.parentOf(lastParent);
		} while (parent != null);
		return lastParent;
	}
1076368
def takeFromTree(self):
        
        tree = self.treeWidget()
        parent = self.parent()
        
        if parent:
            parent.takeChild(parent.indexOfChild(self))
        else:
            tree.takeTopLevelItem(tree.indexOfTopLevelItem(self))
794614
def root_parent(self, category=None):
        
        return next(filter(lambda c: c.is_root, self.hierarchy()))
533441
def root
      if parent_ids.present?
        base_class.find(parent_ids.first)
      else
        self.root? ? self : self.parent.root
      end
    end
214806
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent)
    {
        UIComponent c = parent;
        do
        {
            if (c instanceof UIViewRoot)
            {
                return (UIViewRoot) c;
            }
            else
            {
                c = c.getParent();
            }
        } while (c != null);

        UIViewRoot root = ctx.getFacesContext().getViewRoot();
        if (root == null)
        {
            root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext());
        }
        return root;
    }
60445
def _find_parent(self, path_elements):
        """"""
        if not self.path_elements:
            # Automatically terminate on root
            return self
        elif self.path_elements == path_elements[0:len(self.path_elements)]:
            return self
        else:
            return self.parent._find_parent(path_elements)
1251255
def get_parent(self):
        """"""
        return None if self.zoom == 0 else self.tile_pyramid.tile(
            self.zoom - 1, self.row // 2, self.col // 2
        )
28865
def get_parent_data(tree, node, current):
        
        if not current:
            current = []

        parent = tree.parent(node.identifier)
        if parent.is_root():
            return current

        current.insert(0, (parent.tag, parent.data))
        return PlateManager.get_parent_data(tree, parent, current)
1211165
def root(self):
        ''''''
        with self._mutex:
            if self._parent:
                return self._parent.root
            else:
                return self
698473
def get_parent_label(self, treepos):
        
        parent_pos = self.get_parent_treepos(treepos)
        if parent_pos is not None:
            parent = self.dgtree[parent_pos]
            return parent.label()
        else:
            return None
967127
def get(self, item):
        
        e = self._deps.get(item)
        if e is None:
            return self.get_default()
        return e.parent
1139150
def index_of_item(self, item):
        
        # root has an invalid index
        if item == self._root:
            return QtCore.QModelIndex()
        # find all parents to get their index
        parents = [item]
        i = item
        while True:
            parent = i.parent()
            # break if parent is root because we got all parents we need
            if parent == self._root:
                break
            if parent is None:
                # No new parent but last parent wasn't root!
                # This means that the item was not in the model!
                return QtCore.QModelIndex()
            # a new parent was found and we are still not at root
            # search further until we get to root
            i = parent
            parents.append(parent)

        # get the parent indexes until
        index = QtCore.QModelIndex()
        for treeitem in reversed(parents):
            parent = treeitem.parent()
            row = parent.childItems.index(treeitem)
            index = self.index(row, 0, index)
        return index
510067
def _get_parent(self):
        """"""
        _dir = os.path.dirname(self.path)
        if is_repo(_dir):
            return Local(_dir)
        else:
            return None