Gets the leaf item of the given path.
508054
String getItemName(URI path) {
    Preconditions.checkNotNull(path);

    // There is no leaf item for the root path.
    if (path.equals(GCS_ROOT)) {
      return null;
    }

    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);

    if (resourceId.isBucket()) {
      return resourceId.getBucketName();
    }

    int index;
    String objectName = resourceId.getObjectName();
    if (FileInfo.objectHasDirectoryPath(objectName)) {
      index = objectName.lastIndexOf(PATH_DELIMITER, objectName.length() - 2);
    } else {
      index = objectName.lastIndexOf(PATH_DELIMITER);
    }
    return index < 0 ? objectName : objectName.substring(index + 1);
  }
1127527
def get_leaves(self):
        ""
        leaves = self._get_leaves()
        leaves.sort(key=(lambda x: x._path))  # FF sorts "mixed" last
        return leaves
844248
@Override
    public Node get(ArchivePath path) {
        Validate.notNull(path, "No path was specified");
        Node node = content.get(path);
        if (node == null && contains(path)) {
            node = getNestedNode(path);
        }
        return node;
    }
20861
function getItems(obj, path) {
        var pathItems = Array.isArray(path) ? path : path.split('.'),
            elm = obj,
            items = [];

        pathItems.some(function (key, index) {
            var isLastKey = (index + 1 === pathItems.length);
            elm = elm[key];

            if (elm === undefined) {
                return false;
            }

            if (Array.isArray(elm)) {
                elm.forEach(function (val) {
                    if (isLastKey) {
                        items.push(val);
                    } else {
                        items = items.concat(getItems(val, pathItems.slice(index + 1)));
                    }
                });
                return true;
            }

            // not array, so, object or primitive
            if (isLastKey) {
                items.push(elm);
                return true;
            }

            return false;
        });

        return items;
    }
1216178
@SuppressWarnings("unchecked")
	public TreeNode<T> findByPath(T... path) {
		return findByPath(Arrays.asList(path));
	}
1026368
def Get(self, path):
        '''  '''
        self.getting = path
        try:
            obj = self.dir.Get(path)
            return self.apply_view(obj)
        except DoesNotExist as dne:
            #print dir(dne)
            raise DoesNotExist(
                str(dne) + "[{0}]".format(self.__class__.__name__))
342613
function(path) {
    var index = this;
    if (path !== null) {
      for (var i = 0; i < path.length; i++) {
        var id = path[i];
        index.scopes[id] = index.scopes[id] || { nodes: {}, scopes: {} };
        index = index.scopes[id];
      }
    }
    return index;
  }
430964
def get_resource_by_path(self, path, folder_key=None):
        
        logger.debug("resolving %s", path)

        # remove empty path components
        path = posixpath.normpath(path)
        components = [t for t in path.split(posixpath.sep) if t != '']

        if not components:
            # request for root
            return Folder(
                self.api.folder_get_info(folder_key)['folder_info']
            )

        resource = None

        for component in components:
            exists = False
            for item in self._folder_get_content_iter(folder_key):
                name = item['name'] if 'name' in item else item['filename']

                if name == component:
                    exists = True
                    if components[-1] != component:
                        # still have components to go through
                        if 'filename' in item:
                            # found a file, expected a directory
                            raise NotAFolderError(item['filename'])
                        folder_key = item['folderkey']
                    else:
                        # found the leaf
                        resource = item
                    break

                if resource is not None:
                    break

            if not exists:
                # intermediate component does not exist - bailing out
                break

        if resource is None:
            raise ResourceNotFoundError(path)

        if "quickkey" in resource:
            file_info = self.api.file_get_info(
                resource['quickkey'])['file_info']
            result = File(file_info)
        elif "folderkey" in resource:
            folder_info = self.api.folder_get_info(
                resource['folderkey'])['folder_info']
            result = Folder(folder_info)

        return result
646672
function findItem( path, items ) {
  var result = null;
  items.forEach( function ( item ) {
    if (!result && item instanceof MenuItem && item.paths.filter( function( value ) {
        return value === path;
      } ).length > 0)
      result = item;
    if (!result && item instanceof MenuNode) {
      var child = findItem( path, item.children );
      if (child)
        result = child;
    }
  } );
  return result;
}
577440
function getWatcherByPath(path) {
        var rlt = undefined;

        watchers.forEach(function(watcher) {
            if (watcher.path == path)
                rlt = watcher;
        });

        return rlt;
    }
1119680
public Optional<OPFItem> getItemByPath(String path)
  {
    return Optional.fromNullable(itemsByPath.get(path));
  }
843701
def find(self, path):
    """"""
    keys = ['^'] + path.split(os.path.sep)
    for i in range(len(keys)):
      # See if we have a match at position i.  We have such a match if following the path
      # segments into the trie, from the root, leads us to a terminal.
      node = self._root
      langs = set()
      j = i
      while j < len(keys):
        child = node.get_child(keys[j], langs)
        if child is None:
          break
        else:
          node = child
          j += 1
      if node.is_terminal:
        if j == 1:  # The match was on the root itself.
          path = ''
        else:
          path = os.path.join(*keys[1:j])
        return self._source_root_factory.create(path, langs, node.category)
      # Otherwise, try the next value of i.
    return None
1257895
def get(path)
      path = path.split(/\./) if path.is_a?(String)
      candidate = self
      while !path.empty?
        key = path.shift
        if candidate[key]
          candidate = candidate[key]
        else
          candidate = nil
          last
        end
      end
      candidate
    end
123710
def get(self, path, default=None):
        

        try:
            return self.__getitem__(path)
        except KeyError as error:
            return default
1285022
def traverse(path, request, resource):
    

    path = path.lstrip(b"/")
    for component in path and path.split(b"/"):
        if getattr(resource, "is_leaf", False):
            break
        resource = resource.get_child(name=component, request=request)
    return resource
958702
def collection(self, path):
        """"""
        data = []
        for item in self.get_collection(path):
            data.append(item)
        return data
47163
public static Path<?> getPath(Path<?> path, String propertyPath) {
        if (StringUtils.isEmpty(propertyPath)) return path;

        String name = StringUtils.substringBefore(propertyPath, PropertyUtils.PROPERTY_SEPARATOR);
        Path<?> p = path.get(name);

        return getPath(p, StringUtils.substringAfter(propertyPath, PropertyUtils.PROPERTY_SEPARATOR));

    }