Function to clean up ca temp file for requests.

        **Returns:** Removes TEMP ca file, no return
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()
1000167
def clean(dry_run='n'):
    """"""
    file_patterns = ['*.pyc', '*.pyo', '*~']
    dir_patterns = ['__pycache__']
    recursive_pattern_delete(project_paths.root, file_patterns, dir_patterns, dry_run=bool(dry_run.lower() == 'y'))
406610
def cache_clear(self):
        
        # Delete content of local cache directory
        for f in os.listdir(self.directory):
            f = os.path.join(self.directory, f)
            if os.path.isfile(f):
                os.remove(f)
            elif os.path.isdir(f):
                shutil.rmtree(f)
        # Empty cache index
        self.cache = {}
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)
1346330
def temp_files(self):
        
        ret_list = []
        for key, val in self.file_dict.items():
            # For temp files we only want files that were marked for removal
            if val & FileFlags.rm_mask:
                ret_list.append(key)
        return ret_list
1312972
private void removeTempDirectory() {
        try {
            if (tempDirectory != null && Files.exists(tempDirectory)) {
                Files.walkFileTree(tempDirectory, new DeleteVisitor());
            }
        } catch (IOException e) {
            LOGGER.debug("Could not clean temp directory", e);
        }
    }
242915
public void cleanup() {
        if (file != null && file.exists() && !file.delete()) {
            LOGGER.debug("Failed to delete first temporary file {}", file.toString());
            file.deleteOnExit();
        }
    }
732827
def _clear_temp_dir():
    
    tempdir = get_tempdir()
    for fname in os.listdir(tempdir):
        try:
            os.remove( os.path.join(tempdir, fname) )
        except Exception:
            pass
209962
def cleanup():
    """"""
    temp_dirs = []
    for key in ('headless', 'headed'):
        if FIREFOX_INSTANCE[key] is not None:
            if FIREFOX_INSTANCE[key].profile:
                temp_dirs.append(FIREFOX_INSTANCE[key].profile.profile_dir)
            try:
                FIREFOX_INSTANCE[key].quit()
                FIREFOX_INSTANCE[key] = None
            except:
                logger.exception(
                    "Exception occurred in browser cleanup"
                )
    for temp_dir in temp_dirs:
        shutil.rmtree(temp_dir, ignore_errors=True)
296367
def cleanup_pycache():
    
    try:
        for file in glob.glob('setup.py[co]'):
            os.remove(file)
        if isdir('__pycache__'):
            for file in glob.glob(join('__pycache__', 'setup.*.py[co]')):
                os.remove(file)
            if not glob.glob(join('__pycache__', '*')):
                os.rmdir('__pycache__')
    except (IOError, OSError):
        pass
437425
def clear_data(self, request):
        
        for key in request.session.keys():
            if key.startswith(constants.SESSION_KEY):
                del request.session[key]
1237819
def _cleanup_tempdir(tempdir):
    """"""
    try:
        shutil.rmtree(tempdir)
    except OSError as err:
        if err.errno != errno.ENOENT:
            raise
695610
def clean():
    ''''''

    basedir = dirname(__file__)

    print(cyan('delete temp files and dirs for packaging'))
    local(flo(
        'rm -rf  '
        '{basedir}/.eggs/  '
        '{basedir}/fabsetup.egg-info/  '
        '{basedir}/dist  '
        '{basedir}/README  '
        '{basedir}/build/  '
    ))

    print(cyan('\ndelete temp files and dirs for editing'))
    local(flo(
        'rm -rf  '
        '{basedir}/.cache  '
        '{basedir}/.ropeproject  '
    ))

    print(cyan('\ndelete bytecode compiled versions of the python src'))
    # cf. http://stackoverflow.com/a/30659970
    local(flo('find  {basedir}/fabsetup  '
              'fabfile*  ') +
          '\( -name \*pyc -o -name \*.pyo -o -name __pycache__ '
          '-o -name \*.so -o -name \*.o -o -name \*.c \) '
          '-prune '
          '-exec rm -rf {} + || true')
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);
    }
1364966
def tempdir():
    """"""
    directory_path = tempfile.mkdtemp()

    def clean_up():  # pylint: disable=missing-docstring
        shutil.rmtree(directory_path, onerror=on_error)

    with cd(directory_path, clean_up):
        yield directory_path
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();
	}
470147
def clear_all(self):
        
        for urlpath in self._metadata.keys():
            self.clear_cache(urlpath)

        # Safely clean up anything else.
        if not os.path.isdir(self._cache_dir):
            return
        for subdir in os.listdir(self._cache_dir):
            try:
                fn = posixpath.join(self._cache_dir, subdir)
                if os.path.isdir(fn):
                    shutil.rmtree(fn)
                if os.path.isfile(fn):
                    os.remove(fn)
            except (OSError, IOError) as e:
                logger.warning(str(e))