<commit_before>import * as util from 'gulp-util';
import * as chalk from 'chalk';
import * as rimraf from 'rimraf';
import {readdirSync, lstatSync} from 'fs';
import {join} from 'path';
import {TOOLS_DIR} from '../../config';

export = done => {
  deleteAndWalk(TOOLS_DIR);
  done();
}

function walk(path) {
  let files = readdirSync(path);
  for (let i = 0; i < files.length; i += 1) {
    let curPath = join(path, files[i]);
    if (lstatSync(curPath).isDirectory()) { // recurse
      deleteAndWalk(curPath);
    }
  }
}

function deleteAndWalk(path) {
  try {
    rimraf.sync(join(path, '*.js'));
    util.log('Deleted', chalk.yellow(`${path}/*.js`));
  } catch (e) {
    util.log('Error while deleting', chalk.yellow(`${path}/*.js`), e);<commit_msg>#618 no implicity any fix<commit_after>import * as util from 'gulp-util';
import * as chalk from 'chalk';
import * as rimraf from 'rimraf';
import {readdirSync, lstatSync} from 'fs';
import {join} from 'path';
import {TOOLS_DIR} from '../../config';

export = (done: any) => {
  deleteAndWalk(TOOLS_DIR);
  done();
}

function walk(path: any) {
  let files = readdirSync(path);
  for (let i = 0; i < files.length; i += 1) {
    let curPath = join(path, files[i]);
    if (lstatSync(curPath).isDirectory()) { // recurse
      deleteAndWalk(curPath);
    }
  }
}

function deleteAndWalk(path: any) {
  try {
    rimraf.sync(join(path, '*.js'));
    util.log('Deleted', chalk.yellow(`${path}/*.js`));
  } catch (e) {
    util.log('Error while deleting', chalk.yellow(`${path}/*.js`), e);
{'fraction_non_alphanumeric': 0.19233268356075373, 'fraction_numerical': 0.004548408057179987, 'mean_word_length': 3.782608695652174, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6415799', 'n_tokens_mistral': 577, 'n_tokens_neox': 556, 'n_words': 140}