<commit_before>// Utility library
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

require('defaultable')(module,
  { 'request_timeout': 5000
  }, function(module, exports, DEFS, require) {

var request = require('request')
  , events = require('events')
  , log4js = require('log4js')
  ;

exports.log4js = require('log4js');
exports.LOG_LEVEL = process.env.cqs_log_level || "info";

// A workaround since defaultable seems to be breaking `instanceof` since it re-evaluates modules a lot.
exports.instanceof = function instance0f(obj, type) {
  if(typeof type != 'function' || typeof obj != 'object')
    return false;
  return !!(obj && obj.constructor && obj.constructor.name === type.name);
}

exports.scrub_creds = function scrub_creds(url) {
  return url.replace(/^(https?:\/\/)[^:]+:[^@]+@(.*)$/, '$1$2'); // Scrub username and password
}

exports.JP = JSON.parse;
exports.JS = JSON.stringify;
exports.JDUP = function(obj) { return JSON.parse(JSON.stringify(obj)) };

exports.copy = function(src, dst, pred) {
  pred = pred || function() { return true };
  if(pred === 'uppercase')
    pred = function(key) { return /^[A-Z]/.test(key) };

  Object.keys(src).forEach(function(key) {<commit_msg>Disable log4js for now<commit_after>// Utility library
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

require('defaultable')(module,
  { 'request_timeout': 5000
  }, function(module, exports, DEFS, require) {

var request = require('request')
  , events = require('events')
  //, log4js = require('log4js')

exports.LOG_LEVEL = process.env.cqs_log_level || "info";

// No more log4js for now.
function noop() {}
exports.log4js = {'getLogger':function() { return new FauxLogger }}
function FauxLogger () {
  this.setLevel = this.debug = noop
}

// A workaround since defaultable seems to be breaking `instanceof` since it re-evaluates modules a lot.
exports.instanceof = function instance0f(obj, type) {
  if(typeof type != 'function' || typeof obj != 'object')
    return false;
  return !!(obj && obj.constructor && obj.constructor.name === type.name);
}

exports.scrub_creds = function scrub_creds(url) {
  return url.replace(/^(https?:\/\/)[^:]+:[^@]+@(.*)$/, '$1$2'); // Scrub username and password
}

exports.JP = JSON.parse;
exports.JS = JSON.stringify;
exports.JDUP = function(obj) { return JSON.parse(JSON.stringify(obj)) };

exports.copy = function(src, dst, pred) {
  pred = pred || function() { return true };
  if(pred === 'uppercase')
    pred = function(key) { return /^[A-Z]/.test(key) };

  Object.keys(src).forEach(function(key) {
{'fraction_non_alphanumeric': 0.15018212384421406, 'fraction_numerical': 0.008685906416363126, 'mean_word_length': 4.035260930888575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3323315', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1059, 'n_words': 350}