during the cleanup phase, remove the directory if there's no '*-diff.png' in it (aka, the screenshots comparison went fine)
198221
function removeDirIfOk(p) {
  return globP(path.join(p, '*' + consts.DIFF_PNG_SUFFIX))
    .then(function(res) {
      if (res.length === 0) {
        return rimrafP(p);
      }
      return Promise.resolve();
    });
}
446799
def clean(self):
        
        #TODO: add cleaning of mask files, *if* created ...
        for f in self.catalog_names:
            if 'match' in f:
                if os.path.exists(self.catalog_names[f]):
                    log.info('Deleting intermediate match file: %s'%
                                self.catalog_names[f])
                    os.remove(self.catalog_names[f])
            else:
                for extn in f:
                    if os.path.exists(extn):
                        log.info('Deleting intermediate catalog: %d'%extn)
                        os.remove(extn)
590514
def clean(ctx):
    
    ctx.run(f"python setup.py clean")
    dist = ROOT.joinpath("dist")
    print(f"[clean] Removing {dist}")
    if dist.exists():
        shutil.rmtree(str(dist))
1237385
function checkDirForConflicts(root) {
  const files = fs.readdirSync(root);
  const conflicts = files.filter((file) => !config.validFiles.includes(file));

  if (conflicts.length > 0) {
    console.log();
    console.log(
      `The directory ${chalk.green(root)} contains files that could conflict:`,
    );
    console.log();
    for (const file of conflicts) {
      console.log(`  ${file}`);
    }
    console.log();
    console.log(
      'Either try using a new directory name, or remove the files listed above.',
    );

    process.exit(1);
  }
}
14168
def _default_cleanup(self):
        
        if not self.inplace:
            return

        shutil.move(
            os.path.join(self.build_lib, "bezier", "lib"),
            os.path.join("src", "bezier"),
        )
950239
function clean(path, done) {
        log('Cleaning: ' + $.util.colors.green(path));
        return del(path, done);
    }
1183085
private void tidyUpMonitoredDirectory(boolean createdDir, File dirToCleanup) {
        if (createdDir && dirToCleanup != null) {
            File[] fileListing = dirToCleanup.listFiles();
            if (fileListing == null || fileListing.length == 0) {
                if (!!!dirToCleanup.delete()) {
                    Tr.error(_tc, "MONITOR_DIR_CLEANUP_FAIL", dirToCleanup);
                } else if (_tc.isDebugEnabled()) {
                    //put the message that we were successful in debug so that we know it worked in automated testing
                    Tr.debug(_tc, "Server deleted the old dropins directory " + dirToCleanup);
                }
            }
        }
    }
540798
function _deleteDir(path) {
  if (fs.existsSync(path)) {
    var subpaths = fs.readdirSync(path);
    subpaths.forEach(function(subpath) {
      var curPath = path + '/' + subpath;
      if (fs.lstatSync(curPath).isDirectory()) {
        _deleteDir(curPath);
      } else {
        fs.unlinkSync(curPath);
      }
    });
    fs.rmdirSync(path);
  }
}
243669
def clean(deltox=False):
    '''
    '''

    basedir = dirname(__file__)

    print(cyan('delete temp files and dirs for packaging'))
    local(flo(
        'rm -rf  '
        '{basedir}/.eggs/  '
        '{basedir}/utlz.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}/utlz  {basedir}/tests  ') +
          '\( -name \*pyc -o -name \*.pyo -o -name __pycache__ '
          '-o -name \*.so -o -name \*.o -o -name \*.c \) '
          '-prune '
          '-exec rm -rf {} +')

    if deltox:
        print(cyan('\ndelete tox virual environments'))
        local(flo('cd {basedir}  &&  rm -rf .tox/'))
897837
def clean():
    """"""
    run('rm -rf build/')
    run('rm -rf dist/')
    run('rm -rf puzzle.egg-info')
    run('find . -name __pycache__ -delete')
    run('find . -name *.pyc -delete')
    run('find . -name *.pyo -delete')
    run('find . -name *~ -delete')

    log.info('cleaned up')
302506
def fix_icon(dir)
      if File.exists?(dir+"/icon.png")
        # All ok
      elsif File.exists?(dir+"/icon-lg.png")
        FileUtils.mv(dir+"/icon-lg.png", dir+"/icon.png")
      else
        FileUtils.cp(@opts.template+"/resources/images/default-guide.png", dir+"/icon.png")
      end
    end
69453
def clean(self):
        
        if self._initialized:
            logger.info("brace yourselves, removing %r", self.path)
            shutil.rmtree(self.path)
959532
def remove_dot(self):
        
        if os.path.isfile("{0}.dot".format(self.image)):
            os.remove("{0}.dot".format(self.image))
309025
def cleanup_images(self, remove_old=False, keep_tags=None, **kwargs):
        
        self.push_log("Checking images for dependent images and containers.")
        set_raise_on_error(kwargs, False)
        return super(DockerFabricClient, self).cleanup_images(remove_old=remove_old, keep_tags=keep_tags, **kwargs)
403697
def is_dirty(self, index=True, working_tree=True, untracked_files=False,
                 submodules=True, path=None):
        
        if self._bare:
            # Bare repositories with no associated working directory are
            # always consired to be clean.
            return False

        # start from the one which is fastest to evaluate
        default_args = ['--abbrev=40', '--full-index', '--raw']
        if not submodules:
            default_args.append('--ignore-submodules')
        if path:
            default_args.append(path)
        if index:
            # diff index against HEAD
            if osp.isfile(self.index.path) and \
                    len(self.git.diff('--cached', *default_args)):
                return True
        # END index handling
        if working_tree:
            # diff index against working tree
            if len(self.git.diff(*default_args)):
                return True
        # END working tree handling
        if untracked_files:
            if len(self._get_untracked_files(path, ignore_submodules=not submodules)):
                return True
        # END untracked files
        return False
360618
def cleanup():
        """"""
        for install_dir in linters.INSTALL_DIRS:
            try:
                shutil.rmtree(install_dir, ignore_errors=True)
            except Exception:
                print(
                    "{0}\nFailed to delete {1}".format(
                        traceback.format_exc(), install_dir
                    )
                )
                sys.stdout.flush()
572860
def clean_tmpdir(path):
    """"""
    if os.path.exists(path) and \
       os.path.isdir(path):
        rmtree(path)