<commit_before>"use strict";

var request = require('request'),
    tar   = require('tar'),
    zlib    = require('zlib'),
    Promise = require("bluebird"),
    _       = require('lodash');


Promise.config({
    // Enables all warnings except forgotten return statements.
    warnings: {
        wForgottenReturn: false
    }
});

function Mailchimp (api_key, dc = null) {
  var api_key_regex = /.+\-.+/

  if (!api_key_regex.test(api_key) && dc === null) {
    throw new Error('missing or invalid api key: ' + api_key)
  }


  this.__api_key = api_key;
  if(dc !== null){
    this.__base_url = "https://us"+ dc + ".api.mailchimp.com/3.0"
    console.log(this.__base_url)
  }else{
    this.__base_url = "https://"+ this.__api_key.split('-')[1] + ".api.mailchimp.com/3.0"
  }
}

var formatPath = function (path, path_params) {

  if (!path) {
    path = '/';
  }

  if (path[0] != '/') {
    path = '/' + path;
  }

  if (!path_params) {
    return path;
  }

  if (_.isEmpty(path_params)) {
    return path;
  }

  path = _.reduce(path_params, function (_path, value, param) {
    return _path.replace('{'+param+'}', value);<commit_msg>Use DC value and let us be part of the DC env variable<commit_after>"use strict";

var request = require('request'),
    tar   = require('tar'),
    zlib    = require('zlib'),
    Promise = require("bluebird"),
    _       = require('lodash');


Promise.config({
    // Enables all warnings except forgotten return statements.
    warnings: {
        wForgottenReturn: false
    }
});

function Mailchimp (api_key, dc = null) {
  var api_key_regex = /.+\-.+/

  if (!api_key_regex.test(api_key) && dc === null) {
    throw new Error('missing or invalid api key: ' + api_key)
  }


  this.__api_key = api_key;
  if(dc !== null){
    this.__base_url = "https://"+ dc + ".api.mailchimp.com/3.0"
  }else{
    this.__base_url = "https://"+ this.__api_key.split('-')[1] + ".api.mailchimp.com/3.0"
  }
}

var formatPath = function (path, path_params) {

  if (!path) {
    path = '/';
  }

  if (path[0] != '/') {
    path = '/' + path;
  }

  if (!path_params) {
    return path;
  }

  if (_.isEmpty(path_params)) {
    return path;
  }

  path = _.reduce(path_params, function (_path, value, param) {
    return _path.replace('{'+param+'}', value);
{'fraction_non_alphanumeric': 0.18054338299737072, 'fraction_numerical': 0.0052585451358457495, 'mean_word_length': 2.792358803986711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '7158425', 'n_tokens_mistral': 836, 'n_tokens_neox': 811, 'n_words': 180}