<commit_before>var mkdirp = require('mkdirp');

Blockchain = function(blockchainConfig) {
  this.config = blockchainConfig;
}

Blockchain.prototype.generate_basic_command = function() {
  var config = this.config;
  var address = config.account.address;

  var cmd = "geth ";
  var rpc_api = ['eth', 'web3', 'admin', 'net', 'miner'];

  if (config.datadir !== "default") {
    cmd += "--datadir=\"" + config.datadir + "\" ";
    cmd += "--logfile=\"" + config.datadir + ".log\" ";
  }

  if (config.geth_extra_opts) {
    cmd += config.geth_extra_opts + " ";
  }

  
  cmd += "--port " + config.port + " ";
  cmd += "--rpc ";
  cmd += "--rpcport " + config.rpcPort + " ";
  cmd += "--rpcaddr " + config.rpcHost + " ";
  cmd += "--networkid " + config.networkId + " ";
  cmd += "--rpccorsdomain \"" + config.rpcWhitelist + "\" ";

  if(config.testnet){
    cmd += "--testnet "
  }

  if (config.minerthreads !== void 0) {
    cmd += "--minerthreads \"" + config.minerthreads + "\" ";
  }

  if(config.mine)
    cmd += "--mine ";

  if (config.minerthreads !== void 0)
    cmd += "--minerthreads \"" + config.minerthreads + "\" ";

  if (config.genesisBlock !== void 0)
    cmd += "--genesis=\"" + config.genesisBlock + "\" ";

  if (config.whisper) {
    cmd += "--shh ";
    rpc_api.push('shh')
  }

  cmd += '--rpcapi "' + rpc_api.join(',') + '" ';

  cmd += "--maxpeers " + config.maxPeers + " ";

  if (config.account.password !== void 0) {
    cmd += "--password " + config.account.password + " ";
  }

  return cmd;
}

Blockchain.prototype.list_command = function() {
  return this.generate_basic_command() + "account list ";
}

Blockchain.prototype.init_command = function() {
  return this.generate_basic_command() + "account new ";
}

Blockchain.prototype.geth_command = function(geth_args) {
  return this.generate_basic_command() + geth_args;
}

Blockchain.prototype.run_command = function(address, use_tmp) {
  var cmd = this.generate_basic_command();
  var config = this.config;

  if (address !== void 0) {
    cmd += "--unlock " + address + " ";
  }

  if (config.bootNodes.boot == true){
    cmd += "--bootnodes \"";
    for (var i = 0; i < config.bootNodes.enodes.length; i++){
      cmd += config.bootNodes.enodes[i];
      if (i != config.bootNodes.enodes.lenth - 1) cmd += " ";
    }
    cmd += "\"";
  }

  if (config.mine_when_needed) {
    if (use_tmp) {
      cmd += "js /tmp/js/mine.js";
    }
    else {
      cmd += "js node_modules/embark-framework/js/mine.js";
    }
  }

  return cmd;
}

Blockchain.prototype.get_address = function() {
  var config = this.config;

  if(config.account.address)
    return config.account.address;
<commit_msg>add NAT options<commit_after>var mkdirp = require('mkdirp');

Blockchain = function(blockchainConfig) {
  this.config = blockchainConfig;
}

Blockchain.prototype.generate_basic_command = function() {
  var config = this.config;
  var address = config.account.address;

  var cmd = "geth ";
  var rpc_api = ['eth', 'web3', 'admin', 'net', 'miner'];

  if (config.datadir !== "default") {
    cmd += "--datadir=\"" + config.datadir + "\" ";
    cmd += "--logfile=\"" + config.datadir + ".log\" ";
  }

  if (config.geth_extra_opts) {
    cmd += config.geth_extra_opts + " ";
  }

  
  cmd += "--port " + config.port + " ";
  cmd += "--rpc ";
  cmd += "--rpcport " + config.rpcPort + " ";
  cmd += "--rpcaddr " + config.rpcHost + " ";
  cmd += "--networkid " + config.networkId + " ";
  cmd += "--rpccorsdomain \"" + config.rpcWhitelist + "\" ";

  if(config.testnet){
    cmd += "--testnet "
  }

  if (config.minerthreads !== void 0) {
    cmd += "--minerthreads \"" + config.minerthreads + "\" ";
  }

  if(config.mine)
    cmd += "--mine ";

  if (config.minerthreads !== void 0)
    cmd += "--minerthreads \"" + config.minerthreads + "\" ";

  if (config.genesisBlock !== void 0)
    cmd += "--genesis=\"" + config.genesisBlock + "\" ";

  if (config.whisper) {
    cmd += "--shh ";
    rpc_api.push('shh')
  }

  cmd += '--rpcapi "' + rpc_api.join(',') + '" ';

  cmd += "--maxpeers " + config.maxPeers + " ";

  if (config.account.password !== void 0) {
    cmd += "--password " + config.account.password + " ";
  }

  return cmd;
}

Blockchain.prototype.list_command = function() {
  return this.generate_basic_command() + "account list ";
}

Blockchain.prototype.init_command = function() {
  return this.generate_basic_command() + "account new ";
}

Blockchain.prototype.geth_command = function(geth_args) {
  return this.generate_basic_command() + geth_args;
}

Blockchain.prototype.run_command = function(address, use_tmp) {
  var cmd = this.generate_basic_command();
  var config = this.config;

  if (address !== void 0) {
    cmd += "--unlock " + address + " ";
  }
  
  if (config.nat !== "any"){
    cmd += "--nat \"" + config.nat "\"";
  }

  if (config.bootNodes.boot == true){
    cmd += "--bootnodes \"";
    for (var i = 0; i < config.bootNodes.enodes.length; i++){
      cmd += config.bootNodes.enodes[i];
      if (i != config.bootNodes.enodes.lenth - 1) cmd += " ";
    }
    cmd += "\"";
  }

  if (config.mine_when_needed) {
    if (use_tmp) {
      cmd += "js /tmp/js/mine.js";
    }
    else {
      cmd += "js node_modules/embark-framework/js/mine.js";
    }
  }

  return cmd;
}

Blockchain.prototype.get_address = function() {
  var config = this.config;

  if(config.account.address)
    return config.account.address;

{'fraction_non_alphanumeric': 0.19653072522605647, 'fraction_numerical': 0.002952574275696623, 'mean_word_length': 2.811533052039381, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1154205', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1887, 'n_words': 362}