Joins the path segments into a path.

    Args:
      path_segments (list[str]): path segments.

    Returns:
      str: joined path segments prefixed with the path separator.
189690
def JoinPath(self, path_segments):
    
    # For paths on Windows we need to make sure to handle the first path
    # segment correctly.
    first_path_segment = None

    if path_segments and platform.system() == 'Windows':
      # Check if the first path segment contains a "special" path definition.
      first_path_segment = path_segments[0]
      first_path_segment_length = len(first_path_segment)
      first_path_segment_prefix = None

      # In case the path start with: \\.\C:\
      if (first_path_segment_length >= 7 and
          first_path_segment.startswith('\\\\.\\') and
          first_path_segment[5:7] == ':\\'):
        first_path_segment_prefix = first_path_segment[4:6]
        first_path_segment = first_path_segment[7:]

      # In case the path start with: \\.\ or \\?\
      elif (first_path_segment_length >= 4 and
            first_path_segment[:4] in ['\\\\.\\', '\\\\?\\']):
        first_path_segment_prefix = first_path_segment[:4]
        first_path_segment = first_path_segment[4:]

      # In case the path start with: C:
      elif first_path_segment_length >= 2 and first_path_segment[1] == ':':
        first_path_segment_prefix = first_path_segment[:2]
        first_path_segment = first_path_segment[2:]

      # In case the path start with: \\server\share (UNC).
      elif first_path_segment.startswith('\\\\'):
        prefix, _, remainder = first_path_segment[2:].partition(
            self.PATH_SEPARATOR)

        first_path_segment_prefix = '\\\\{0:s}'.format(prefix)
        first_path_segment = '\\{0:s}'.format(remainder)

      if first_path_segment_prefix:
        first_path_segment, _, remainder = first_path_segment.partition(
            self.PATH_SEPARATOR)

        if not remainder:
          _ = path_segments.pop(0)
        else:
          path_segments[0] = remainder

        first_path_segment = ''.join([
            first_path_segment_prefix, first_path_segment])

      else:
        first_path_segment = None

    # We are not using os.path.join() here since it will not remove all
    # variations of successive path separators.

    # Split all the path segments based on the path (segment) separator.
    path_segments = [
        segment.split(self.PATH_SEPARATOR) for segment in path_segments]

    # Flatten the sublists into one list.
    path_segments = [
        element for sublist in path_segments for element in sublist]

    # Remove empty path segments.
    path_segments = list(filter(None, path_segments))

    if first_path_segment is None:
      path = '{0:s}{1:s}'.format(
          self.PATH_SEPARATOR, self.PATH_SEPARATOR.join(path_segments))
    else:
      path = first_path_segment
      if path_segments:
        path = '{0:s}{1:s}{2:s}'.format(
            path, self.PATH_SEPARATOR, self.PATH_SEPARATOR.join(path_segments))

    return path
1289339
def join_paths(fnames:FilePathList, path:PathOrStr='.')->Collection[Path]:
    ""
    path = Path(path)
    return [join_path(o,path) for o in fnames]
585302
def split_path(path):
        
        components = list()
        while path:
            next = win32.PathFindNextComponent(path)
            if next:
                prev = path[ : -len(next) ]
                components.append(prev)
            path = next
        return components
304758
def join(path1, path2):
    '''
    
    '''
    if path1.endswith('/') and path2.startswith('/'):
        return ''.join([path1, path2[1:]])
    elif path1.endswith('/') or path2.startswith('/'):
        return ''.join([path1, path2])
    else:
        return ''.join([path1, '/', path2])
1158189
def paths_for_shell(paths, separator=' '):
    
    paths = filter(None, paths)
    paths = map(shlex.quote, paths)
    if separator is None:
        return paths
    return separator.join(paths)
1030530
def join_paths(path1: Optional[str], path2: Optional[str]) -> Optional[str]:
    
    if path1 is not None and path2 is not None:
        return os.path.join(path1, path2)
170449
def _get_joined_path(ctx):
    
    return b'/' + b'/'.join(seg.encode('utf-8') for seg in ctx.path)
76720
def path_join(*args):
    
    args = (paramiko.py3compat.u(arg) for arg in args)
    return os.path.join(*args)
133562
def __get_segments_from_cycle(graph, cycle_path):
    """"""
    list_of_segments = []
    # We work through the cycle in a bottom-up fashion
    for n in cycle_path[::-1]:
        segments = __get_segments_from_node(n, graph)
        if segments:
            list_of_segments.append(segments)

    return list_of_segments
460185
function() {

            var segments = this.segments;
            var numSegments = segments.length;
            // works even if path has no segments

            var path = new Path();
            for (var i = 0; i < numSegments; i++) {

                var segment = segments[i].clone();
                path.appendSegment(segment);
            }

            return path;
        }
398983
def relpath(path, start):
    
    path_items = path_list(path)
    start_items = path_list(start)

    # Find common parts of path.
    common = []
    for pth, stt in zip(path_items, start_items):
        if pth != stt:
            break
        common.append(pth)

    # Shared parts index in both lists.
    common_ind = len(common)
    parent_num = len(start_items) - common_ind

    # Start with parent traversal and add relative parts.
    rel_items = [PARENT] * parent_num + path_items[common_ind:]
    return path_join(*rel_items)
961883
def segments(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.segments(index=self._name, **kwargs)
551940
def parse_segments(warc_paths)
      segments = Hash.new 0

      warc_paths.split.each do |warc_path|
        segment_name = warc_path.split('/')[3]
        segments[segment_name] += 1 if segment_name.present?
      end

      segments
    end
1304236
def path_segment(self, index, value=None, default=None):
        
        if value is not None:
            segments = list(self.path_segments())
            segments[index] = unicode_quote_path_segment(value)
            new_path = '/' + '/'.join(segments)
            if self._tuple.path.endswith('/'):
                new_path += '/'
            return URL._mutate(self, path=new_path)
        try:
            return self.path_segments()[index]
        except IndexError:
            return default
895949
def join_path(fname:PathOrStr, path:PathOrStr='.')->Path:
    ""
    return Path(path)/Path(fname)
1182489
function join(/*varags*/) {
	var segs = Array.prototype.slice.call(arguments);
	var path = [];
	for (var i=0; i < segs.length; i++) {
		var segment = segs[i];
		// This is kind of cheesy: avoid double-slashes
		var last = segment.length-1;
		if (i > 0 && segment[0] === '/') segment = segment.substring(1);
		if (segment[last] === '/') segment = segment.substring(0, last);
		path.push(segment);
	}
	return path.join('/');
}
747744
def join_url_parts(*args):
    
    # check for edge case
    if len(args) == 1:
        return args[0]

    return_val = clean_url_segment(args[0])

    for i in range(1, len(args)):
        arg = args[i]

        if i == len(args) - 1:
            # no need to remove a trailing slash if this is the last segment
            return_val += '/' + arg
        else:
            # remove a trailing slash so it won't be duplicated
            return_val += '/' + clean_url_segment(arg)

    return return_val