Remove tmp prefix from file path or url.
7275
def remove_tmp_prefix_from_file_path(file_path):
    
    path, filename = os.path.split(file_path)
    return os.path.join(path, remove_tmp_prefix_from_filename(filename)).replace('\\', '/')
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)
1159713
def _strip_schema(url):
    """"""
    result = parse_url(url, allow_fragments=False)
    return result.netloc + result.path
1028827
function stripCommonPath(paths) {
  var prefix = commonPrefix(paths);
  var prefixLength = prefix.lastIndexOf('/') + 1;

  return paths.map(function(str) {
    return str.slice(prefixLength);
  });
}
1027416
def strip_optional_prefix(string, prefix, log=None):
    
    if string.startswith(prefix):
        return string[len(prefix):]
    if log:
        log.warn('String starts with %r, not %r', string[:len(prefix)], prefix)
    return string
201434
def clean_path(p):
    
    p = os.path.expanduser(p)
    p = os.path.expandvars(p)
    p = os.path.abspath(p)
    return p
201882
def cleanup(self):
        ""
        log.info('Removing temp dir %s', self._tempdir.name)
        self._tempdir.cleanup()
226550
def tmppath(root=TEMPS_DIR, prefix=TEMPS_PREFIX, suffix=TEMPS_SUFFIX):
    '''
    
    '''
    return os.path.join(root, prefix + uuid.uuid4().hex + suffix)
182661
def _cleanup(path: str) -> None:
    """"""
    if os.path.isdir(path):
        shutil.rmtree(path)
572860
def clean_tmpdir(path):
    """"""
    if os.path.exists(path) and \
       os.path.isdir(path):
        rmtree(path)
618474
def clear_temp(wdir, rmdir=True):
    """"""
    wdir = pathlib.Path(wdir)
    extensions = ["*.log", "*.dat", "*.txt"]

    for ext in extensions:
        for ff in wdir.glob(ext):
            ff.unlink()

    if rmdir:
        wdir.rmdir()
625017
def clean_tmpdir
      self.root_dir.each do |d|
        if d != '..' and d!='.'
          if d.to_i < Time.now.to_i-TIME_LIMIT
            FileUtils.rm_rf(File.join(self.root_dir.path, d))
          end
        end
      end
    end
1255235
public static final String removePathPrefix(File prefix, File file) {
		final String r = file.getAbsolutePath().replaceFirst(
				"^" //$NON-NLS-1$
				+ Pattern.quote(prefix.getAbsolutePath()),
				EMPTY_STRING);
		if (r.startsWith(File.separator)) {
			return r.substring(File.separator.length());
		}
		return r;
	}
255959
def unprefix(self, path):
        """"""
        path = self.strip(path)
        if isinstance(path, six.string_types):
            path = path[len(self.prefix_):] if path.startswith(self.prefix_) else path
            path = path[1:] if path.startswith(self.separator) else path
            return path
        if isinstance(path, (list, tuple)):
            path = [p[len(self.prefix_):] if p.startswith(self.prefix_) else p for p in path]
            path = [p[1:] if p.startswith(self.separator) else p for p in path]
            return path
527417
function removeCommonPrefix(basedir, filedir) {
  var baseparts = basedir.split(path.sep);
  var fileparts = filedir.split(path.sep);

  var i = 0;
  while (i < fileparts.length && fileparts[i] === baseparts[i]) {
    i++;
  }
  return fileparts.slice(i).join(path.sep);
}
1204315
def remove_file(file_path):
    """"""
    if path.exists(file_path):
        try:
            rmtree(file_path)
        except Exception:
            print('Unable to remove temporary workdir {}'.format(file_path))
104573
def CleanUp(self, path):
    """"""
    try:
      if os.path.exists(path):
        os.remove(path)
    except (OSError, IOError) as e:
      logging.info("Failed to remove temporary file %s. Err: %s", path, e)