<commit_before>const Promise = require('bluebird');

const db = {
    registerDsn: (dsns) => {
        dsns.forEach((dsn) => {
            db.conn(dsn);
        })
    },
    _conn: {},
    conn: (dsn) => {
        var key;

        if (typeof(dsn) == 'string') {
            key = dsn;
        }
        else if (dsn.key) {
            key = dsn.key;
        }
        else {
            key = dsn.client + '|' + dsn.connection.database + '|' + dsn.connection.host + '|' + dsn.connection.user;
        }

        if (db._conn[key]) {
            return db._conn[key];
        }

        db._conn[key] = require('knex')(dsn);
        return db._conn[key];
    },
    knex: (dsn) => {
        return db.conn(dsn);
    },
    tran: (blocks, dsn) => {
        return db.conn(dsn).transaction((tran) => {
            var results = [];

            return await(new Promise((resolve, reject) => {<commit_msg>add type check for dsn.<commit_after>const Promise = require('bluebird');

const db = {
    registerDsn: (dsns) => {
        if (dsns && dsns.hasOwnProperty('forEach')) {
            dsns.forEach((dsn) => {
                db.conn(dsn);
            })
        }
    },
    _conn: {},
    conn: (dsn) => {
        var key;

        if (typeof(dsn) == 'string') {
            key = dsn;
        }
        else if (dsn.key) {
            key = dsn.key;
        }
        else {
            key = dsn.client + '|' + dsn.connection.database + '|' + dsn.connection.host + '|' + dsn.connection.user;
        }

        if (db._conn[key]) {
            return db._conn[key];
        }

        db._conn[key] = require('knex')(dsn);
        return db._conn[key];
    },
    knex: (dsn) => {
        return db.conn(dsn);
    },
    tran: (blocks, dsn) => {
        return db.conn(dsn).transaction((tran) => {
            var results = [];

            return await(new Promise((resolve, reject) => {
{'fraction_non_alphanumeric': 0.1733615221987315, 'fraction_numerical': 0.0, 'mean_word_length': 1.5072847682119206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1414473', 'n_tokens_mistral': 644, 'n_tokens_neox': 635, 'n_words': 113}