<commit_before>
import Promise from 'bluebird'
import spawn from 'win-spawn'

let self = {
  platform: function () {
    return process.platform
  },

  arch: function () {
    return process.arch
  },

  process_type: function () {
    return process.type || 'browser'
  },

  get_version: function (key) {
    return process.versions[key]
  },

  /**
   * Get platform in the format used by the itch.io API
   */
  itch_platform: function () {
    switch (self.platform()) {
      case 'darwin':
        return 'osx'
      case 'win32':
        return 'windows'
      case 'linux':
        return 'linux'
    }
  },

  cli_args: function () {
    return process.argv
  },

  check_presence: function (command, args = [], parser = null) {
    return new Promise((resolve, reject) => {
      let child = spawn(command, args)

      let stdout = ''
      child.stdout.on('data', (data) => stdout += data)

      let stderr = ''
      child.stderr.on('data', (data) => stderr += data)

      child.on('error', (e) => null)
      child.on('close', (code) => {
        if (code === 0) {
          let parsed = null
          if (parser) {
            let matches = (stdout + '\n' + stderr).match(parser)
            if (matches) {
              console.log(`found matches: ${JSON.stringify(matches)}`)
              parsed = matches[1]
            }
          }

          resolve({code, stdout, stderr, parsed})
        } else {
          reject(new Error(`${command} exited with code ${code}\n${stdout}\n${stderr}`))
        }
      })
    })
  }
}

export default self<commit_msg>debug--<commit_after>
import Promise from 'bluebird'
import spawn from 'win-spawn'

let self = {
  platform: function () {
    return process.platform
  },

  arch: function () {
    return process.arch
  },

  process_type: function () {
    return process.type || 'browser'
  },

  get_version: function (key) {
    return process.versions[key]
  },

  /**
   * Get platform in the format used by the itch.io API
   */
  itch_platform: function () {
    switch (self.platform()) {
      case 'darwin':
        return 'osx'
      case 'win32':
        return 'windows'
      case 'linux':
        return 'linux'
    }
  },

  cli_args: function () {
    return process.argv
  },

  check_presence: function (command, args = [], parser = null) {
    return new Promise((resolve, reject) => {
      let child = spawn(command, args)

      let stdout = ''
      child.stdout.on('data', (data) => stdout += data)

      let stderr = ''
      child.stderr.on('data', (data) => stderr += data)

      child.on('error', (e) => null)
      child.on('close', (code) => {
        if (code === 0) {
          let parsed = null
          if (parser) {
            let matches = (stdout + '\n' + stderr).match(parser)
            if (matches) {
              parsed = matches[1]
            }
          }

          resolve({code, stdout, stderr, parsed})
        } else {
          reject(new Error(`${command} exited with code ${code}\n${stdout}\n${stderr}`))
        }
      })
    })
  }
}

export default self
{'fraction_non_alphanumeric': 0.14995131450827653, 'fraction_numerical': 0.002596559558584875, 'mean_word_length': 2.0215686274509803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6562448', 'n_tokens_mistral': 965, 'n_tokens_neox': 938, 'n_words': 244}