Find the path root.
        @param parts: A list of path parts.
        @type parts: [str,..]
        @return: The root.
        @rtype: L{xsd.sxbase.SchemaObject}
778399
def root(self, parts):
        
        result = None
        name = parts[0]
        log.debug('searching schema for (%s)', name)
        qref = self.qualify(parts[0])
        query = BlindQuery(qref)
        result = query.execute(self.schema)
        if result is None:
            log.error('(%s) not-found', name)
            raise PathResolver.BadPath(name)
        log.debug('found (%s) as (%s)', name, Repr(result))
        return result
901182
def get_schema_descendant(
            self, route: SchemaRoute) -> Optional[SchemaNode]:
        
        node = self
        for p in route:
            node = node.get_child(*p)
            if node is None:
                return None
        return node
165650
def get_path_components(directory):
    
    drive, dirs = os.path.splitdrive(directory)
    folders = []
    previous = ""
    while dirs != previous and dirs != "":
        previous = dirs
        dirs, folder = os.path.split(dirs)
        if folder != "":
            folders.append(folder)
    folders.reverse()
    return drive, folders
192158
function getPathDirectory(length, parts) {
  if (!parts) {
    return '';
  }
  return parts
    .slice(length)
    .filter(part => part !== '')
    .join(path.sep);
}
424107
def make_path(*path_or_str_or_segments):
    
    if len(path_or_str_or_segments) == 0:
        return ROOT_PATH
    elif len(path_or_str_or_segments) == 1:
        single_item = path_or_str_or_segments[0]
        if isinstance(single_item, Path):
            return single_item
        if isinstance(single_item, str):
            try:
                return path_parser.parseString(single_item, True).asList()[0]
            except:
                raise ValueError()
        raise TypeError()
    else:
        segments = path_or_str_or_segments
        return sum(map(lambda x: make_path(x), segments), ROOT_PATH)
114495
def path(*components):
    
    _path = os.path.join(*components)
    _path = os.path.expanduser(_path)

    return _path
945062
def _findroot(self, x):
        """"""
        if x.startswith("."):
            x = x[1:]
        if not x.endswith("."):
            x += "."
        max = 0
        root = "."
        root_key = ""
        for k in six.iterkeys(self):
            if x.startswith(k + "."):
                if max < len(k):
                    max = len(k)
                    root = self[k]
                    root_key = k
        return root, root_key, x[max:-1]
1323608
String getPath() {
    StringBuilder result = new StringBuilder();

    boolean first = true;
    for (String part : getSegments()) {
      if (first) {
        result.append(part);
        first = false;
      } else {
        result.append("/").append(part);
      }
    }

    return result.toString();
  }
471285
def root(self):
            
            str_treeRoot                = '/'
            self.l_cwd                  = [str_treeRoot]
            self.snode_current          = self.snode_root
            self.sbranch_current        = self.sbranch_root
574317
def _root(name='', all_roots=False):
    '''
    
    '''
    if _sd_version() >= 219:
        if all_roots:
            return [os.path.join(x, name)
                    for x in ('/var/lib/machines', '/var/lib/container')]
        else:
            return os.path.join('/var/lib/machines', name)
    else:
        ret = os.path.join('/var/lib/container', name)
        if all_roots:
            return [ret]
        else:
            return ret
1362663
def get_xpath_branch(xroot, xpath):
    

    if xroot and xpath and xpath.startswith(xroot):
        xpath = xpath[len(xroot):]
        xpath = xpath.lstrip(XPATH_DELIM)

    return xpath
1226759
def relpath(self, path):
        
        for root in self.roots:
            # Root is regex, convert to matching root string
            if isinstance(root, Pattern):
                match = root.match(path)
                if not match:
                    continue
                root = match.group(0)

            # Split root and relative path
            try:
                relative = path.split(root, 1)[1]
                # Strip "/" only at path start. "/" is used to known if
                # path is a directory on some cloud storage.
                return relative.lstrip('/')
            except IndexError:
                continue

        return path
1359703
def path(self, which=None):
        
        if which:
            return '{0}/{1}'.format(
                super(Template, self).path(which='base'), which)
        return super(Template, self).path(which)
1290092
def path(self, which=None):
        
        if which == 'clone':
            return '{0}/{1}'.format(
                super(Role, self).path(which='self'),
                which
            )
        return super(Role, self).path(which)
97561
def _reconstruct(self, path_to_root):

        '''
            
        '''

    # split path to root into segments
        item_pattern = re.compile('\d+\\]')
        dot_pattern = re.compile('\\.|\\[')
        path_segments = dot_pattern.split(path_to_root)

    # construct base schema endpoint
        schema_endpoint = self.schema

    # reconstruct schema endpoint from segments
        if path_segments[1]:
            for i in range(1,len(path_segments)):
                if item_pattern.match(path_segments[i]):
                    schema_endpoint = schema_endpoint[0]
                else:
                    schema_endpoint = schema_endpoint[path_segments[i]]

        return schema_endpoint
1372969
public String getFullPath()
  {
    if (_root == this || _root == null)
      return getPath();

    String rootPath = _root.getFullPath();
    String path = getPath();

    if (rootPath.length() <= 1)
      return path;
    else if (path.length() <= 1)
      return rootPath;
    else
      return rootPath + path;
  }
672849
function(root, path) {
				if (path.indexOf(this.SEPARATOR) === 0) {
					root = this.rootNode;
					path = path.substring(1);
				} else {
					if (!root) {
						if (!this.currentDirectory) {
							/* no node to resolve the path in terms of */
							return null;
						}
						root = this.currentDirectory;
					}
				}
				var segments = path.substring(0, path.lastIndexOf(this.SEPARATOR)).split(this.SEPARATOR);
				var result = root;
				for (var i = 0; i < segments.length; i++) {
					if (segments[i].length > 0) {
						result = this.getChild(result, segments[i]);
						if (!result || !result.Directory) {
							/* non-existent directory */
							return null;
						}
					}
				}

				/*
				 * If the full path represents a directory then initiate the
				 * retrieval of its full node info and children.
				 */
				var lastSegment = path.substring(path.lastIndexOf(this.SEPARATOR) + 1);
				var child = this.getChild(result, lastSegment);
				if (child) {
					this._retrieveNode(child);
				}

				if (!result.Children) {
					this._retrieveNode(result);
				}
				return result;
			}