Remove all file system contents and reset the root.
324588
def reset(self, total_size=None):
        """"""
        self.root = FakeDirectory(self.path_separator, filesystem=self)
        self.cwd = self.root.name

        self.open_files = []
        self._free_fd_heap = []
        self._last_ino = 0
        self._last_dev = 0
        self.mount_points = {}
        self.add_mount_point(self.root.name, total_size)
        self._add_standard_streams()
415137
def close(self):
        """"""
        self._filesystem.open_files[self.filedes].remove(self)
        os.close(self.fd)
1228608
def remove_files(root_dir):
    
    for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)):
        for filename in filenames:
            os.remove(os.path.join(root_dir, filename))

        for dirname in dirnames:
            shutil.rmtree(os.path.join(root_dir, dirname))
735158
def clear_file_systems(self):
        """"""

        self._source_url = None
        self.dataset.config.library.source.url = None
        self._source_fs = None

        self._build_url = None
        self.dataset.config.library.build.url = None
        self._build_fs = None

        self.dataset.commit()
151913
def cleanup(config=None, path=None):
    """"""
    if config is None:
        config = parse()
    if path is None:
        path = os.getcwd()
    root = config.get('root', 'path')
    root = os.path.join(path, root)
    if sys.path[0] == root:
        sys.path.remove(root)
443861
protected function cleanup()
    {
        $this->filesystem->remove($this->tmpFolder);
        $this->root = null;
        $this->urlsets = array();
    }
419722
def revert(self):
        
        os.environ.clear()
        os.environ.update(self.original)
252655
def _cleanup(self):
        """"""
        self._expkg = None
        self._extmp = None
        self._flag_e = True
        self._ifile.close()
805656
def cleanup(self):
        
        if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
            if os.path.exists(self.path):
                try:
                    rmtree(self.path)
                except OSError:
                    pass
                else:
                    self.path = None
1306978
def cleanup():
    """"""
    lib_dir = os.path.join(os.environ['CONTAINER_DIR'], '_lib')
    if os.path.exists(lib_dir):
        shutil.rmtree(lib_dir)
    os.mkdir(lib_dir)
1028632
def clean(self):
        """"""
        if os.path.exists(self.buildroot):
            log.info('Clearing the build area.')
            log.debug('Deleting: %s', self.buildroot)
            shutil.rmtree(self.buildroot)
            os.makedirs(self.buildroot)
1034359
def cleanup():
    """"""
    if _output_dir and os.path.exists(_output_dir):
        log.msg_warn("Cleaning up output directory at '{output_dir}' ..."
                     .format(output_dir=_output_dir))
        if not _dry_run:
            shutil.rmtree(_output_dir)
929355
public function cleanup()
    {
        if ($this->isEnabled() && $this->hasPattern() && realpath($this->installDir)) {
            $paths = iterator_to_array($this->finder->in($this->installDir));

            /** @var \SplFileInfo $path */
            foreach ($paths as $path) {
                $this->filesystem->remove($path);
            }
        }
    }
1090803
def cleanup(self):
        """"""
        shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
        if os.path.exists(self.name):
            raise IOError(17, "File exists: '{}'".format(self.name))
1150998
def _clean_up(self):
        ''''''
        self.logger.info('Beginning Clean Up Process')
        try:
            if self.origin_path:
                self.logger.info('Removing Origin Directory - %s', self.origin_path)
                shutil.rmtree(self.origin_path)
            self.logger.info('Removing Working Directory - %s', self.dir_path)
            shutil.rmtree(self.dir_path)
            self.logger.info('Clean Up Process Complete')
        except Exception as e:    #pragma: no cover
            self.logger.exception(e)
635252
def cleanup(self):
        """"""
        for path in self.paths:
            if isinstance(path, tuple):
                os.close(path[0])
                os.unlink(path[1])
            else:
                shutil.rmtree(path)
        self.paths = []
379525
def reset(self):
        """"""
        paths = []
        for filename in os.listdir(self.cached_repo):
            if filename.startswith(".git"):
                continue
            path = os.path.join(self.cached_repo, filename)
            if os.path.isfile(path):
                paths.append(path)
            elif os.path.isdir(path):
                for model in os.listdir(path):
                    paths.append(os.path.join(path, model))
        git.remove(self.cached_repo, paths)
        self.contents = {"models": {}, "meta": {}}