Clean out a template temp file
975313
def __clean_tmp(sfn):
    '''
    
    '''
    if sfn.startswith(os.path.join(tempfile.gettempdir(),
                                   salt.utils.files.TEMPFILE_PREFIX)):
        # Don't remove if it exists in file_roots (any saltenv)
        all_roots = itertools.chain.from_iterable(
                six.itervalues(__opts__['file_roots']))
        in_roots = any(sfn.startswith(root) for root in all_roots)
        # Only clean up files that exist
        if os.path.exists(sfn) and not in_roots:
            os.remove(sfn)
415542
function strip(start, end) {
        const before = template.slice(0, start)
        const target = template.slice(start, end)
        const after = template.slice(end)
        template = before + target.replace(/\S/gu, " ") + after
        stripedRanges.push([start, end])
    }
1363552
public static void purgeTempFiles(String tempdir) {
		if (tempdir == null) return;

		s_logger.info("Removing: "+tempdir);
		Path dlPath = Paths.get(tempdir).resolve("chemcomp");
		File[] chemCompOutFiles = finder(dlPath.toString(), "cif.gz");
		if (null != chemCompOutFiles) for (File f : chemCompOutFiles) f.delete();
		dlPath.toFile().delete();
	}
425432
def clean(session):
    
    clean_dirs = (
        get_path(".cache"),
        get_path(".coverage"),
        get_path(".pytest_cache"),
        get_path("__pycache__"),
        get_path("build"),
        get_path("dist"),
        get_path("docs", "__pycache__"),
        get_path("docs", "build"),
        get_path("scripts", "macos", "__pycache__"),
        get_path("scripts", "macos", "dist_wheels"),
        get_path("scripts", "macos", "fixed_wheels"),
        get_path("src", "bezier.egg-info"),
        get_path("src", "bezier", "__pycache__"),
        get_path("src", "bezier", "extra-dll"),
        get_path("src", "bezier", "lib"),
        get_path("tests", "__pycache__"),
        get_path("tests", "functional", "__pycache__"),
        get_path("tests", "unit", "__pycache__"),
        get_path("wheelhouse"),
    )
    clean_globs = (
        get_path(".coverage"),
        get_path("*.mod"),
        get_path("*.pyc"),
        get_path("src", "bezier", "*.pyc"),
        get_path("src", "bezier", "*.pyd"),
        get_path("src", "bezier", "*.so"),
        get_path("src", "bezier", "quadpack", "*.o"),
        get_path("src", "bezier", "*.o"),
        get_path("tests", "*.pyc"),
        get_path("tests", "functional", "*.pyc"),
        get_path("tests", "unit", "*.pyc"),
    )
    for dir_path in clean_dirs:
        session.run(shutil.rmtree, dir_path, ignore_errors=True)
    for glob_path in clean_globs:
        for filename in glob.glob(glob_path):
            session.run(os.remove, filename)
1352279
def out_filename(template, n_val, mode):
    """"""
    return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier)
92523
def clean():
    ""
    src_dir = easy.options.setdefault("docs", {}).get('src_dir', None)
    if src_dir is None:
        src_dir = 'src' if easy.path('src').exists() else '.'

    with easy.pushd(src_dir):
        for pkg in set(easy.options.setup.packages) | set(("tests",)):
            for filename in glob.glob(pkg.replace('.', os.sep) + "/*.py[oc~]"):
                easy.path(filename).remove()
765993
def _cleanup_ca_temp_file(self):
        
        if os.name == 'nt':
            if isinstance(self.ca_verify_filename, (binary_type, text_type)):
                # windows requires file to be closed for access. Have to manually remove
                os.unlink(self.ca_verify_filename)
        else:
            # other OS's allow close and delete of file.
            self._ca_verify_file_handle.close()
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)
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()
639285
private function removeTempDirectory()
    {
        $tempDir       = \sys_get_temp_dir();
        $directoryPath = $tempDir . DIRECTORY_SEPARATOR . 'phpcq-author-validation';

        if (!\file_exists($directoryPath)) {
            return;
        }

        $directory = \opendir($directoryPath);

        while (($file = \readdir($directory)) !== false) {
            if (\in_array($file, ['.', '..'])) {
                continue;
            }

            \unlink($directoryPath . DIRECTORY_SEPARATOR . $file);
        }

        \rmdir($directoryPath);
    }
34655
def cleanup(self):
        """"""
        if self.image:
            try:
                self.image.close()
            except Exception:
                pass
        if (self.outtmp is not None):
            try:
                os.unlink(self.outtmp)
            except OSError as e:
                self.logger.warning("Failed to cleanup tmp output file %s"
                                    % (self.outtmp))
1028240
def remove_program_temp_directory():
    """"""
    if os.path.exists(program_temp_directory):
        max_retries = 3
        curr_retries = 0
        time_between_retries = 1
        while True:
            try:
                shutil.rmtree(program_temp_directory)
                break
            except IOError:
                curr_retries += 1
                if curr_retries > max_retries:
                    raise # re-raise the exception
                time.sleep(time_between_retries)
            except:
                print("Cleaning up temp dir...", file=sys.stderr)
                raise
584536
def clean(ctx):
    
    ctx.run(f"python setup.py clean")
    dist = ROOT.joinpath("dist")
    build = ROOT.joinpath("build")
    print(f"[clean] Removing {dist} and {build}")
    if dist.exists():
        shutil.rmtree(str(dist))
    if build.exists():
        shutil.rmtree(str(build))
1314311
def clean(ctx):
    ''''''
    header(clean.__doc__)
    with ctx.cd(ROOT):
        for pattern in CLEAN_PATTERNS:
            info(pattern)
            ctx.run('rm -rf {0}'.format(' '.join(CLEAN_PATTERNS)))
947852
def clean():
    """"""
    rm("$testfn*")
    rm("*.bak")
    rm("*.core")
    rm("*.egg-info")
    rm("*.orig")
    rm("*.pyc")
    rm("*.pyd")
    rm("*.pyo")
    rm("*.rej")
    rm("*.so")
    rm("*.~")
    rm("*__pycache__")
    rm(".coverage")
    rm(".tox")
    rm(".coverage")
    rm("build")
    rm("dist")
    rm("docs/_build")
    rm("htmlcov")
    rm("tmp")
    rm("venv")
47114
private void cleanUp(File f) {
        if (f != null && f.getParentFile() != null) {
            if (m_absoluteTempPath.equalsIgnoreCase(f
                    .getParentFile().getAbsolutePath())) {
                f.delete();
            }
        }
    }
1369016
def cleanTempDirs(job):
    """"""
    if job is CWLJob and job._succeeded:  # Only CWLJobs have this attribute.
        for tempDir in job.openTempDirs:
            if os.path.exists(tempDir):
                shutil.rmtree(tempDir)
        job.openTempDirs = []