<commit_before>/**
 * Core
 * Created by CreaturePhil - https://github.com/CreaturePhil
 *
 * This is where essential core infrastructure of
 * Pokemon Showdown extensions for private servers.
 * Core contains standard streams, profile infrastructure,
 * elo rating calculations, and polls infrastructure.
 *
 * @license MIT license
 */

var fs = require("fs");
var path = require("path");

var core = exports.core = {

    stdin: function (file, name) {
        var data = fs.readFileSync('config/' + file + '.csv', 'utf8').split('\n');

        var len = data.length;
        while (len--) {
            if (!data[len]) continue;
            var parts = data[len].split(',');
            if (parts[0].toLowerCase() === name) {
                return parts[1];
            }
        }
        return 0;
    },
    
    checkAmt: function(name, target) {
        var userdata = fs.readFileSync('config/money.js');
        var amt = JSON.parse(userdata);
        if (!amt[toId(name)]) return 0;
        if (amt[toId(name)][target]) {
            return amt[toId(name)][target];
        } else {
            return 0;
        }
    },
	
	transferAmt: function(user1, user2, type, amount) {
        var userdata = fs.readFileSync('config/money.js');
        var amt = JSON.parse(userdata);
        if (!amt[toId(user2)]) amt[toId(user2)] = {};
        if (!amt[toId(user2)][type]) amt[toId(user2)] = 0;
        parseInt(amt[toId(user1)][type]) -= parseInt(amount);
        parseInt(amt[toId(user2)][type]) += parseInt(amount);
        var finished = JSON.stringify(amt, null, 1);
        fs.writeFile('config/money.js', finished);
        return;
    },

    stdout: function (file, name, info, callback) {
        var data = fs.readFileSync('config/' + file + '.csv', 'utf8').split('\n');
        var match = false;

        var len = data.length;
        while (len--) {
            if (!data[len]) continue;
            var parts = data[len].split(',');
            if (parts[0] === name) {<commit_msg>Update core.js<commit_after>/**
 * Core
 * Created by CreaturePhil - https://github.com/CreaturePhil
 *
 * This is where essential core infrastructure of
 * Pokemon Showdown extensions for private servers.
 * Core contains standard streams, profile infrastructure,
 * elo rating calculations, and polls infrastructure.
 *
 * @license MIT license
 */

var fs = require("fs");
var path = require("path");

var core = exports.core = {

    stdin: function (file, name) {
        var data = fs.readFileSync('config/' + file + '.csv', 'utf8').split('\n');

        var len = data.length;
        while (len--) {
            if (!data[len]) continue;
            var parts = data[len].split(',');
            if (parts[0].toLowerCase() === name) {
                return parts[1];
            }
        }
        return 0;
    },
    
    checkAmt: function(name, target) {
        var userdata = fs.readFileSync('config/money.csv');
        var amt = JSON.parse(userdata);
        if (!amt[toId(name)]) return 0;
        if (amt[toId(name)][target]) {
            return amt[toId(name)][target];
        } else {
            return 0;
        }
    },
	
	transferAmt: function(user1, user2, type, amount) {
        var userdata = fs.readFileSync('config/money.csv');
        var amt = JSON.parse(userdata);
        if (!amt[toId(user2)]) amt[toId(user2)] = {};
        if (!amt[toId(user2)][type]) amt[toId(user2)] = 0;
        parseInt(amt[toId(user1)][type]) -= parseInt(amount);
        parseInt(amt[toId(user2)][type]) += parseInt(amount);
        var finished = JSON.stringify(amt, null, 1);
        fs.writeFile('config/money.csv', finished);
        return;
    },

    stdout: function (file, name, info, callback) {
        var data = fs.readFileSync('config/' + file + '.csv', 'utf8').split('\n');
        var match = false;

        var len = data.length;
        while (len--) {
            if (!data[len]) continue;
            var parts = data[len].split(',');
            if (parts[0] === name) {
{'fraction_non_alphanumeric': 0.16142714570858283, 'fraction_numerical': 0.008982035928143712, 'mean_word_length': 2.27265306122449, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '295266', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1247, 'n_words': 301}