Selects a repository tree item given a path, expanding nodes if along the way if needed.

            Returns (item, index) if the path was selected successfully, else a warning is logged
            and (None, None) is returned.
343958
def trySelectRtiByPath(self, path):
        
        try:
            lastItem, lastIndex = self.repoWidget.repoTreeView.expandPath(path)
            self.repoWidget.repoTreeView.setCurrentIndex(lastIndex)
            return lastItem, lastIndex
        except Exception as ex:
            logger.warn("Unable to select {!r} because: {}".format(path, ex))
            if DEBUGGING:
                raise
            return None, None
1221034
def __rmtree(path):
    
    logger.info("rmtree: %s" % path)
    try:
        shutil.rmtree(path)
        return True
    except Exception as e:
        logger.error("rmtree: %s failed! Error: %s" % (path, e))
        return False
900351
def _selectTree( self ):
        
        self.uiGanttTREE.blockSignals(True)
        self.uiGanttTREE.clearSelection()
        for item in self.uiGanttVIEW.scene().selectedItems():
            item.treeItem().setSelected(True)
        self.uiGanttTREE.blockSignals(False)
457212
def get_item(self, path):
        
        if self.source_folder:
            item_path = '%s/%s/%s' % (
                    current_app.static_folder,
                    self.source_folder,
                    path.strip('/')
                )
        else:
            item_path = '%s/%s' % (
                    current_app.static_folder,
                    path.strip('/')
                )

        if os.path.isfile(item_path):
            try:
                return Image.open(item_path)
            except IOError as err:
                LOGGER.warning('File not found on path "%s" with error: %s' % (item_path, str(err)))
                return False
        else:
            return False
364283
def get_selected_object(self):
        
        model, paths = self.tree_view.get_selection().get_selected_rows()
        if len(paths) == 1:
            return self.tree_store.get_iter(paths[0]), paths[0]
        else:
            return None, paths
317779
def _checkpath(self, path):
        
        if path.startswith("/") or ".." in path or path.strip() != path:
            raise NotFoundException()
458540
def itemByPath( self, path, includeRoot = False ):
        
        sep     = self.separator()
        path    = nativestring(path).strip(sep)
        if ( not path ):
            if ( includeRoot ):
                return self.invisibleRootItem()
            else:
                return None
            
        splt    = path.split(sep)
        item    = self.invisibleRootItem()
        for part in splt:
            next_item = None
            for row in range(item.rowCount()):
                child = item.child(row)
                if ( child.text() == part ):
                    next_item = child
                    break
            
            if ( not next_item ):
                item = None
                break
                
            item = next_item
            item.initialize()
        
        return item
971161
def tree_lookup(self, target_path, commit):
        
        segments = target_path.split("/")
        tree_or_blob = commit.tree
        path = ''
        while segments:
            dirent = segments.pop(0)
            if isinstance(tree_or_blob, pygit2.Tree):
                if dirent in tree_or_blob:
                    tree_or_blob = self.repo[tree_or_blob[dirent].oid]
                    # self.logger.debug("  %s in %s" % (dirent, path))
                    if path:
                        path += '/'
                    path += dirent
                else:
                    # This is probably because we were called on a
                    # commit whose parent added a new directory.
                    self.logger.debug("        %s not in %s in %s" %
                                      (dirent, path, commit.hex[:8]))
                    return None
            else:
                self.logger.debug("        %s not a tree in %s" %
                                  (tree_or_blob, commit.hex[:8]))
                return None
        return tree_or_blob
199039
protected Node getContentNode(Session session, String path)
            throws RepositoryException {
        Node node = null;
        try {
            Item item = session.getItem(path);
            if (item.isNode()) {
                node = (Node) item;
            } else {
                node = item.getParent();
            }
            while (node != null
                    && !isTargetNode(node)
                    && (path = getTargetPath(node)) != null) {
                node = node.getParent();
            }
        } catch (PathNotFoundException ignore) {
            // probably removed... ignore
        }
        return path != null ? node : null;
    }
466391
def get_node_selectable(node, context):
    """"""
    query_path = node.query_path
    if query_path not in context.query_path_to_selectable:
        raise AssertionError(
            u'Unable to find selectable for query path {} with context {}.'.format(
                query_path, context))
    selectable = context.query_path_to_selectable[query_path]
    return selectable
697744
def get_nodes(self, path):
        

        if self._get_kind(path) != NodeKind.DIR:
            raise ChangesetError("Directory does not exist for revision %s at "
                " '%s'" % (self.revision, path))
        path = self._fix_path(path)

        filenodes = [FileNode(f, changeset=self) for f in self._file_paths
            if os.path.dirname(f) == path]
        dirs = path == '' and '' or [d for d in self._dir_paths
            if d and posixpath.dirname(d) == path]
        dirnodes = [DirNode(d, changeset=self) for d in dirs
            if os.path.dirname(d) == path]

        als = self.repository.alias
        for k, vals in self._extract_submodules().iteritems():
            #vals = url,rev,type
            loc = vals[0]
            cs = vals[1]
            dirnodes.append(SubModuleNode(k, url=loc, changeset=cs,
                                          alias=als))
        nodes = dirnodes + filenodes
        # cache nodes
        for node in nodes:
            self.nodes[node.path] = node
        nodes.sort()

        return nodes
422101
def fetch_node_from(self, path):
        
        context = self
        for key in path:
            context = context[key]
            if context is None:
                break
        return context
21634
def find(self, path, mode='node'):
        
        path = path.split('.') if isinstance(path, str) else list(path)
        item = self

        for child in path:
            escaped_child = sanitize_identifier(child, escape=False)
            matching_children = [c for c in item.children
                                 if child.endswith(c) or escaped_child.endswith(c)]
            matching_children = sorted(matching_children, key=lambda x: -len(x))
            if matching_children:
                item = item[matching_children[0]]
            else:
                continue
        return item if mode == 'node' else item.path
1350754
def setCurrentSchemaPath(self, path):
        
        if not path:
            return False
        
        parts = path.split('.')
        name  = parts[0]
        next  = parts[1:]
        
        if name == self.text(0):
            if next:
                self.load()
                path = '.'.join(next)
                for c in range(self.childCount()):
                    if self.child(c).setCurrentSchemaPath(path):
                        self.setExpanded(True)
                        return True
                return False
            else:
                self.treeWidget().setCurrentItem(self)
                return True
        return False
333757
function isPathMatchSelector(path, selector){
  function isMatch(path, selector){
    path = typeof path == 'string' ? parseRole(path) : path || '';
    selector = typeof selector == 'string' ? parseRole(selector) : selector || '';

    return selector.role == path.role &&
           (selector.roleId == '*' || selector.roleId == path.roleId) &&
           selector.subrole == path.subrole;
  }

  var pathIndex = path.length;
  var selectorIndex = selector.length;

  if (!selectorIndex)
    return true;

  if (!isMatch(path[--pathIndex], selector[--selectorIndex]))
    return false;

  while (pathIndex > 0 && selectorIndex > 0)
    if (!isMatch(path[--pathIndex], selector[--selectorIndex]))
      selectorIndex++;

  return selectorIndex === 0;
}
699734
def getitem_by_path(d, path):
    
    return reduce(
        lambda d, k: d[k],
        path,
        d
    )
507986
def is_component(self, path):
        ''''''
        node = self.get_node(path)
        if not node:
            return False
        return node.is_component