<commit_before>var Rho = Rho || (function ($) {
    'use strict';

    // === API configuration ========================================================

    var thisFileName = 'rhoapi.js';

    var RHO_ID_PARAM = '__rhoID';
    var RHO_CLASS_PARAM = '__rhoClass';
    var RHO_CALLBACK_PARAM = '__rhoCallback';

    var API_CONTROLLER_URL = '/system/js_api_entrypoint';
    //var API_CALLBACK_BASE_URL = '/system/js_api_entrypoint';
    var API_CALLBACK_BASE_URL = '';

    var NOT_INSTANCE_ID = '0';

    // === simplified jQuery 1.9.1 parts =============================================

    var __$$ = {
        isFunction: function (obj) {
            return 'function' === typeof obj;
        },

        isPlainObject: function (obj) {
            return obj && 'object' === typeof obj;
        },

        isArray: function (obj) {
            return (obj && 'Array' == (obj).constructor.name);
        },

        extend: function () {
            var src, copyIsArray, copy, name, options, clone,
                target = arguments[0] || {},
                i = 1,
                length = arguments.length,
                deep = false;

            // Handle a deep copy situation
            if (typeof target === "boolean") {
                deep = target;

                // skip the boolean and the target
                target = arguments[ i ] || {};
                i++;
            }

            // Handle case when target is a string or something (possible in deep copy)
            if (typeof target !== "object" && !__$$.isFunction(target)) {
                target = {};
            }

            // extend jQuery itself if only one argument is passed
            if (i === length) {
                target = this;
                i--;
            }

            for (; i < length; i++) {
                // Only deal with non-null/undefined values
                if ((options = arguments[ i ]) != null) {
                    // Extend the base object
                    for (name in options) {
                        src = target[ name ];
                        copy = options[ name ];

                        // Prevent never-ending loop
                        if (target === copy) {
                            continue;
                        }

                        // Recurse if we're merging plain objects or arrays
                        if (deep && copy && ( __$$.isPlainObject(copy) || (copyIsArray = __$$.isArray(copy)) )) {
                            if (copyIsArray) {
                                copyIsArray = false;
                                clone = src && __$$.isArray(src) ? src : [];

                            } else {
                                clone = src && __$$.isPlainObject(src) ? src : {};
                            }

                            // Never move original objects, clone them
                            target[ name ] = __$$.extend(deep, clone, copy);

                            // Don't bring in undefined values
                        } else if (copy !== undefined) {
                            target[ name ] = copy;
                        }
                    }
                }
            }

            // Return the modified object
            return target;
        },

        ajax: function (opts) {

            if (!opts) return;

            function newXhr() {
                if (typeof XMLHttpRequest !== 'undefined') {
                    return new XMLHttpRequest();
                } else {
                    var versions = ["MSXML2.XmlHttp.5.0",
                        "MSXML2.XmlHttp.4.0",
                        "MSXML2.XmlHttp.3.0",
                        "MSXML2.XmlHttp.2.0",
                        "Microsoft.XmlHttp"]
                    for (var i = 0, len = versions.length; i < len; i++) {
                        try {
                            return new ActiveXObject(versions[i]);
                        } catch (ex) {
                        }
                    }
                }
                return null;
            }

            var xhr = newXhr();

            xhr.onreadystatechange = function () {
                // not ready yet
                if (xhr.readyState < 4) return;

                // error
                if (xhr.status !== 200 && xhr.status !== 0) {
                    // TODO: why 0 is success?
                    // Investigate a native side for iOS.
                    // It looks like it should return something wia HTTP.
                    (opts.error || function () {
                    })(xhr, 'error', xhr.statusText);
                    return;
                }

                // success
                if (xhr.readyState === 4) {
                    var data = null;
                    try {
                        // this API supports JSON responses only
                        data = JSON.parse(xhr.responseText);
                    } catch (ex) {
                    }
                    (opts.success || function () {
                    })(data, 'success', xhr);
                }
            }

            xhr.open(opts.type || 'get', opts.url || '', opts.async === true);

            var hdrs = opts.headers || {};
            for (var name in hdrs) {
                if (!hdrs.hasOwnProperty(name)) continue;
                xhr.setRequestHeader(name, hdrs[name]);
            }

            xhr.send(opts.data);
        },

        each:function (anObjectOrArray, callback) {
            if (this.isArray(anObjectOrArray)) {
                anObjectOrArray.forEach(function (each, idx) {<commit_msg>fixed: no exception on error while sync req with ajax bridge<commit_after>var Rho = Rho || (function ($) {
    'use strict';

    // === API configuration ========================================================

    var thisFileName = 'rhoapi.js';

    var RHO_ID_PARAM = '__rhoID';
    var RHO_CLASS_PARAM = '__rhoClass';
    var RHO_CALLBACK_PARAM = '__rhoCallback';

    var API_CONTROLLER_URL = '/system/js_api_entrypoint';
    //var API_CALLBACK_BASE_URL = '/system/js_api_entrypoint';
    var API_CALLBACK_BASE_URL = '';

    var NOT_INSTANCE_ID = '0';

    // === simplified jQuery 1.9.1 parts =============================================

    var __$$ = {
        isFunction: function (obj) {
            return 'function' === typeof obj;
        },

        isPlainObject: function (obj) {
            return obj && 'object' === typeof obj;
        },

        isArray: function (obj) {
            return (obj && 'Array' == (obj).constructor.name);
        },

        extend: function () {
            var src, copyIsArray, copy, name, options, clone,
                target = arguments[0] || {},
                i = 1,
                length = arguments.length,
                deep = false;

            // Handle a deep copy situation
            if (typeof target === "boolean") {
                deep = target;

                // skip the boolean and the target
                target = arguments[ i ] || {};
                i++;
            }

            // Handle case when target is a string or something (possible in deep copy)
            if (typeof target !== "object" && !__$$.isFunction(target)) {
                target = {};
            }

            // extend jQuery itself if only one argument is passed
            if (i === length) {
                target = this;
                i--;
            }

            for (; i < length; i++) {
                // Only deal with non-null/undefined values
                if ((options = arguments[ i ]) != null) {
                    // Extend the base object
                    for (name in options) {
                        src = target[ name ];
                        copy = options[ name ];

                        // Prevent never-ending loop
                        if (target === copy) {
                            continue;
                        }

                        // Recurse if we're merging plain objects or arrays
                        if (deep && copy && ( __$$.isPlainObject(copy) || (copyIsArray = __$$.isArray(copy)) )) {
                            if (copyIsArray) {
                                copyIsArray = false;
                                clone = src && __$$.isArray(src) ? src : [];

                            } else {
                                clone = src && __$$.isPlainObject(src) ? src : {};
                            }

                            // Never move original objects, clone them
                            target[ name ] = __$$.extend(deep, clone, copy);

                            // Don't bring in undefined values
                        } else if (copy !== undefined) {
                            target[ name ] = copy;
                        }
                    }
                }
            }

            // Return the modified object
            return target;
        },

        ajax: function (opts) {

            if (!opts) return;

            function newXhr() {
                if (typeof XMLHttpRequest !== 'undefined') {
                    return new XMLHttpRequest();
                } else {
                    var versions = ["MSXML2.XmlHttp.5.0",
                        "MSXML2.XmlHttp.4.0",
                        "MSXML2.XmlHttp.3.0",
                        "MSXML2.XmlHttp.2.0",
                        "Microsoft.XmlHttp"]
                    for (var i = 0, len = versions.length; i < len; i++) {
                        try {
                            return new ActiveXObject(versions[i]);
                        } catch (ex) {
                        }
                    }
                }
                return null;
            }

            var xhr = newXhr();

            function stateChangedFor(xhr) {
                return function() {
                    // not ready yet
                    if (xhr.readyState < 4) return;

                    // error
                    if (xhr.status !== 200 && xhr.status !== 0) {
                        // TODO: why 0 is success?
                        // Investigate a native side for iOS.
                        // It looks like it should return something via HTTP.
                        (opts.error || function () {
                        })(xhr, 'error', xhr.statusText);
                        return;
                    }

                    // success
                    if (xhr.readyState === 4) {
                        var data = null;
                        try {
                            // this API supports JSON responses only
                            data = JSON.parse(xhr.responseText);
                        } catch (ex) {
                        }
                        (opts.success || function () {
                        })(data, 'success', xhr);
                    }
                }
            }

            if (opts.async === true) {
                xhr.onreadystatechange = stateChangedFor(xhr);
            }

            xhr.open(opts.type || 'get', opts.url || '', opts.async === true);

            var hdrs = opts.headers || {};
            for (var name in hdrs) {
                if (!hdrs.hasOwnProperty(name)) continue;
                xhr.setRequestHeader(name, hdrs[name]);
            }

            xhr.send(opts.data);
            if (opts.async !== true) {
                stateChangedFor(xhr)();
            }
        },

        each:function (anObjectOrArray, callback) {
            if (this.isArray(anObjectOrArray)) {
                anObjectOrArray.forEach(function (each, idx) {
{'fraction_non_alphanumeric': 0.12327942188575361, 'fraction_numerical': 0.004473503097040606, 'mean_word_length': 1.009160041479433, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '5384196', 'n_tokens_mistral': 2921, 'n_tokens_neox': 2670, 'n_words': 731}