Strip absolute components from path.
    Inspired from zipfile.write().
760567
def _relpath(name):
    
    return os.path.normpath(os.path.splitdrive(name)[1]).lstrip(_allsep)
1043865
function cleanFile(pathToFile) {
  try {
    fs.unlinkSync(pathToFile);
  } catch (err) {
    switch (err.code) {
      case 'ENOENT':
        return;
      default:
        throw new Error(err);
    }
  }
}
346596
def _clean_path(p):
    

    np = os.path.expanduser(p)
    np = os.path.abspath(np)

    return np
618530
def path_components(path):
    
    components = []
    # The loop guarantees that the returned components can be
    # os.path.joined with the path separator and point to the same
    # location:    
    while True:
        (new_path, tail) = os.path.split(path)  # Works on any platform
        components.append(tail)        
        if new_path == path:  # Root (including drive, on Windows) reached
            break
        path = new_path
    components.append(new_path)    
    components.reverse()  # First component first 
    return components
227962
def to_absolute_paths(paths):
    
    abspath = os.path.abspath
    paths = return_set(paths)
    absolute_paths = {abspath(x) for x in paths}
    return absolute_paths
1004202
private static String resolveSibling(String fromPath, String toPath) {
    // If the destination is an absolute path, nothing to do.
    if (toPath.startsWith("/")) {
      return toPath;
    }

    List<String> fromPathParts = new ArrayList<>(Arrays.asList(fromPath.split("/")));
    List<String> toPathParts = new ArrayList<>(Arrays.asList(toPath.split("/")));
    if (!fromPathParts.isEmpty()) {
      fromPathParts.remove(fromPathParts.size() - 1);
    }

    while (!fromPathParts.isEmpty() && !toPathParts.isEmpty()) {
      if (toPathParts.get(0).equals(".")) {
        toPathParts.remove(0);
      } else if (toPathParts.get(0).equals("..")) {
        toPathParts.remove(0);
        fromPathParts.remove(fromPathParts.size() - 1);
      } else {
        break;
      }
    }

    fromPathParts.addAll(toPathParts);
    return String.join("/", fromPathParts);
  }
1159713
def _strip_schema(url):
    """"""
    result = parse_url(url, allow_fragments=False)
    return result.netloc + result.path
178627
function (path) {
                //There has to be an easier way to do this.
                var i, part, ary,
                    firstChar = path.charAt(0);

                if (firstChar !== '/' &&
                        firstChar !== '\\' &&
                        path.indexOf(':') === -1) {
                    //A relative path. Use the current working directory.
                    path = xpcUtil.cwd() + '/' + path;
                }

                ary = path.replace(/\\/g, '/').split('/');

                for (i = 0; i < ary.length; i += 1) {
                    part = ary[i];
                    if (part === '.') {
                        ary.splice(i, 1);
                        i -= 1;
                    } else if (part === '..') {
                        ary.splice(i - 1, 2);
                        i -= 2;
                    }
                }
                return ary.join('/');
            }
1252304
def Clean():
  """"""
  # Find all the compiled proto files and unlink them.
  for (root, _, files) in os.walk(ROOT):
    for filename in files:
      full_filename = os.path.join(root, filename)
      if full_filename.endswith("_pb2.py") or full_filename.endswith(
          "_pb2.pyc"):
        os.unlink(full_filename)
394104
def cleanup(self):
        """"""
        t = time.time()
        for noncefile in glob(self.path + '/*.nonce'):
            if os.path.getmtime(noncefile) + self.expiration > t:
                os.unlink(noncefile)
420950
def to_existing_absolute_path(string):
    """"""
    value = os.path.abspath(string)
    if not os.path.exists( value ) or not os.path.isdir( value ):
        msg = '"%r" is not a valid path to a directory.' % string
        raise argparse.ArgumentTypeError(msg)
    return value
579988
def _absolute_template_path(fn):
    
    return os.path.join(os.path.dirname(__file__), "xslt", fn)
1243817
def strip_chroot_from(path)
    return path unless (chrooted? and path and path.start_with?(chroot_path))
    path[chroot_path.length..-1]
  end
253985
void remove(String absolutePath) {
      if (absolutePath == null)
         return;
      GridFile.Metadata md = metadata.get(absolutePath);
      if (md == null)
         return;

      int numChunks = md.getLength() / md.getChunkSize() + 1;
      for (int i = 0; i < numChunks; i++)
         data.remove(FileChunkMapper.getChunkKey(absolutePath, i));
   }
890401
def abspath(relpath, root=None):
    """"""
    root = root or cwd()
    if op.isfile(root):
        root = op.dirname(root)
    return op.abspath(op.join(root, relpath))
1067607
function strip(file) {
      file.fingerprint = file.fingerprint.slice(0, -3);
      delete file.source;
      delete file.sourcemap;
      delete file.shrinkwrap;
      return file;
    }
34736
def clean():
    
    for dirpath, dirnames, filenames in os.walk('.'):
        for filename in filenames:
            if filename.endswith('.pyc') or filename.endswith('.pyo'):
                filepath = os.path.join(dirpath, filename)
                click.echo(f'Removing {filepath}')
                os.remove(filepath)