splits path into parent, child
9757
def split(path):
    
    if path == '/':
        return ('/', None)

    parent, child = path.rsplit('/', 1)

    if parent == '':
        parent = '/'

    return (parent, child)
356588
private static void joinPath(StringBuilder path, String parent, String child)
    {
        // Add parent piece, with no trailing slash.
        if ( (parent != null) && (parent.length() > 0) )
        {
            if ( !parent.startsWith(PATH_SEPARATOR) )
            {
                path.append(PATH_SEPARATOR);
            }
            if ( parent.endsWith(PATH_SEPARATOR) )
            {
                path.append(parent.substring(0, parent.length() - 1));
            }
            else
            {
                path.append(parent);
            }
        }

        if ( (child == null) || (child.length() == 0) || (child.equals(PATH_SEPARATOR)) )
        {
            // Special case, empty parent and child
            if ( path.length() == 0 )
            {
                path.append(PATH_SEPARATOR);
            }
            return;
        }

        // Now add the separator between parent and child.
        path.append(PATH_SEPARATOR);

        if ( child.startsWith(PATH_SEPARATOR) )
        {
            child = child.substring(1);
        }

        if ( child.endsWith(PATH_SEPARATOR) )
        {
            child = child.substring(0, child.length() - 1);
        }

        // Finally, add the child.
        path.append(child);
    }
1303129
def parent_dir(path):
    ''''''
    return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
351425
def split_subpath(path, subpath)
      return "" if path == subpath
      path = File.join(path, ''.freeze)
      if subpath.start_with?(path)
        subpath[path.length..-1]
      else
        nil
      end
    end
344158
function(root, path)
	{
		var parent = root;
		
		if (path != null)
		{
			var tokens = path.split(mxCellPath.PATH_SEPARATOR);
			
			for (var i=0; i<tokens.length; i++)
			{
				parent = parent.getChildAt(parseInt(tokens[i]));
			}
		}
		
		return parent;
	}
1160015
def resolve_path(root, path):
  """"""
  path = parse_path(path)

  parent = root

  for part in path[:-1]:
    parent = get_child(parent, rfc_6901_replace(part))

  return (parent, rfc_6901_replace(path[-1]))
307769
def select_from(self, parent_path):
        """"""
        path_cls = type(parent_path)
        is_dir = path_cls.is_dir
        exists = path_cls.exists
        scandir = parent_path._accessor.scandir
        if not is_dir(parent_path):
            return iter([])
        return self._select_from(parent_path, is_dir, exists, scandir)
378048
public static String parentPathString(String path) {
        String[] split = componentsFromPathString(path);
        if (split.length > 1) {
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < split.length - 1; i++) {
                if (i > 0) {
                    stringBuilder.append(SEPARATOR);
                }
                stringBuilder.append(split[i]);
            }
            return stringBuilder.toString();
        }
        return "";
    }
742824
def parent(self):
        """"""
        path = '/'.join(self.path.split('/')[:-1])
        s = path.strip('/').split(':')
        if len(s)==2 and s[1]=='':
            return None
        else:
            return self.__class__(self, path=path)
254609
function parent(object, path) {
        return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
      }
55646
function splitPath(path) {
  if (Array.isArray(path)) {
    return path
  }
  if (path[0] === '/') {
    path = path.substr(1)
  }
  if (path[path.length-1] === '/') {
    path = path.substr(0, path.length-1)
  }
  return path.split('/')
}
965307
def split_path(path):
    '''
    
    '''
    def recurse_path(path,retlist):
        if len(retlist) > 100:
            fullpath = os.path.join(*([ path, ] + retlist))
            print("Directory '{}' contains too many levels".format(fullpath))
            exit(1)
        head, tail = os.path.split(path)
        if len(tail) > 0:
            retlist.insert(0,tail)
            recurse_path(head,retlist)
        elif len(head) > 1:
            recurse_path(head,retlist)
        else:
            return

    retlist = []
    path = os.path.realpath(os.path.normpath(path))
    drive, path = os.path.splitdrive(path)
    if len(drive) > 0: retlist.append(drive)
    recurse_path(path,retlist)
    return retlist
713219
def n_parent_paths(self, n):
        
        rv = os.path.relpath(os.path.join(self.path, '..'), os.path.join(self.path, *['..'] * (n+1)))
        return rv.replace('\\', '/')
1085813
function handlePathSlashes (path) {
                var cutIndex = 0;
                for (var i = 0; i < path.length - 1; i++) {
                    if (path[i] === DIR_SEPARATOR && path[i + 1] === DIR_SEPARATOR) {
                        cutIndex = i + 1;
                    } else break;
                }

                return path.substr(cutIndex);
            }
62245
def rec_split_path(path):
    ''''''
    if len(path) > 1 and path.endswith('/'):
        path = path[:-1]
    if '/' not in path:
        return [path,]
    result = []
    while path != '/':
        parent, name = os.path.split(path)
        result.append((path, name))
        path = parent
    result.append(('/', '/'))
    result.reverse()
    return result
818334
def path_to_parts(path)
      path.
        downcase.
        split('/').
        map { |part| part.empty? ? nil : part.strip }.
        compact
    end
612530
def split(path):
    ''
    if path == '':
        raise ValueError('Path may not be empty.')

    dn, fn = os.path.split(path)
    if fn == '':
        return (dn,)
    elif dn == '':
        return (fn,)
    else:
        return split(dn) + (fn,)