<commit_before>/**
 * Class Humble Model
 */
Humble( function () {

    // Class Constants
    var CHANGE      = 'showChange',
        EXTRA       = 'showExtra',
        FILING      = 'filing',
        GROUP       = 'group',
        INCOME      = 'income',
        SORT        = 'sortdir',
        TYPE        = 'type',
        YEAR        = 'year';

    // Constructor
    var DataSource = function () {

    }

    // Methods
    DataSource.prototype = {

        request : function (options) {

            var config = {},
                data   = {};

            // Data
            data[YEAR]      = 2010;
            data[TYPE]      = 0;
            data[SORT]      = 0;
            data[INCOME]    = 50000;
            data[FILING]    = 0;
            data[GROUP]     = 'function';
            data[CHANGE]    = 0;
            data[EXTRA]     = 0;

            // Config
            config = {
                url : 'http://www.whatwepayfor.com/api/getBudgetAggregate',
                dataType : 'jsonp',
                data : data
            };

            // Options
            if ('callback' in options) {
                if ('success' in options.callback) {
                    config.success = options.callback.success;
                }
            }
            if ('income' in options) {
                config.data[INCOME] = options.income;
            }

            jQuery.ajax(config);
        }
    };

    // Namespace Hook
    Humble.DataSource = DataSource;
});<commit_msg>Generalized and simplifed DS to an oo facade of jquery ajax.<commit_after>/**
 * Class Humble Model
 */
Humble( function () {

    // Class Constants
    var CHANGE      = 'showChange',
        DATA_TYPE   = 'dataType',
        EXTRA       = 'showExtra',
        FILING      = 'filing',
        GROUP       = 'group',
        INCOME      = 'income',
        SORT        = 'sortdir',
        SUCCESS     = 'success',
        TYPE        = 'type',
        URL         = 'url',
        YEAR        = 'year';

    var DEFAULT_OPTIONS = {
        dataType : 'jsonp'
    }

    // Constructor
    var DataSource = function (options) {
        this.options = _.extend(DEFAULT_OPTIONS, options);
    }

    // Methods
    DataSource.prototype = {

        request : function (config) {

            var config = (config ? config : {});
                data   = {};

            // Data
            data[YEAR]      = 2010;
            data[TYPE]      = 0;
            data[SORT]      = 0;
            data[INCOME]    = 50000;
            data[FILING]    = 0;
            data[GROUP]     = 'function';
            data[CHANGE]    = 0;
            data[EXTRA]     = 0;

            config = _.extend(this.options, config);
            config.data = (
                config.data ? _.extend(data, config.data) : data
            );

            jQuery.ajax(config);
        }
    };

    // Namespace Hook
    Humble.DataSource = DataSource;
});
{'fraction_non_alphanumeric': 0.11852861035422343, 'fraction_numerical': 0.009536784741144414, 'mean_word_length': 1.129804205946338, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '716371', 'n_tokens_mistral': 884, 'n_tokens_neox': 811, 'n_words': 177}