<commit_before>import { lstat, readdir } from 'fs';
import * as path from 'path';

import promisify from 'es6-promisify';

export var lstatPromise = promisify(lstat);
export var readdirPromise = promisify(readdir);

export function walkPromise(curPath) {
  var result = {};
  // Set a basePath var with the initial path
  // so all file paths (the result keys) can
  // be relative to the starting point.
  var basePath = curPath;

  return (function walk(curPath) {
    return lstatPromise(curPath)
      .then((stat) => {
        if (stat.isFile()) {
          var { size, ...other } = stat;
          result[path.relative(basePath, curPath)] = { size };
        } else if (stat.isDirectory()) {
          return readdirPromise(curPath)
            .then((files) => {
              // Map the list of files and make a list of readdir
              // promises to pass to Promise.all so we can recursively
              // get the data on all the files in the directory.
              return Promise.all(files.map((fileName) => {
                return walk(path.join(curPath, fileName));
              }));
            })
            .then(() => {<commit_msg>Fix lint violation<commit_after>import { lstat, readdir } from 'fs';
import * as path from 'path';

import promisify from 'es6-promisify';

export var lstatPromise = promisify(lstat);
export var readdirPromise = promisify(readdir);

export function walkPromise(curPath) {
  var result = {};
  // Set a basePath var with the initial path
  // so all file paths (the result keys) can
  // be relative to the starting point.
  var basePath = curPath;

  return (function walk(curPath) {
    return lstatPromise(curPath)
      .then((stat) => {
        if (stat.isFile()) {
          var { size } = stat;
          result[path.relative(basePath, curPath)] = { size };
        } else if (stat.isDirectory()) {
          return readdirPromise(curPath)
            .then((files) => {
              // Map the list of files and make a list of readdir
              // promises to pass to Promise.all so we can recursively
              // get the data on all the files in the directory.
              return Promise.all(files.map((fileName) => {
                return walk(path.join(curPath, fileName));
              }));
            })
            .then(() => {
{'fraction_non_alphanumeric': 0.11307725507121277, 'fraction_numerical': 0.0008631851532153647, 'mean_word_length': 2.179698216735254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5347084', 'n_tokens_mistral': 655, 'n_tokens_neox': 648, 'n_words': 219}