<commit_before>/**
 * Adapted from ChaplinJS (http://chaplinjs.org/)
 */
define([
], function(
) {
        'use strict';

        var event, handlerFn;

        var UNSYNCED = 'unsynced',
            SYNCING = 'syncing',
            SYNCED = 'synced',
            STATE_CHANGE = 'syncStateChange';

        var SyncMachine = {

            _syncState         : UNSYNCED,
            _previousSyncState : null,

            syncState: function() {
                return this._syncState;
            },

            isUnsynced: function() {
                return this._syncState === UNSYNCED;
            },

            isSynced: function() {
                return this._syncState === SYNCED;
            },

            isSyncing: function() {
                return this._syncState === SYNCING;
            },

            unsync: function() {
                var state;

                if ((state = this._syncState) === SYNCING || state === SYNCED) {
                    this._previousSync = this._syncState;
                    this._syncState    = UNSYNCED;

                    this.trigger(this._syncState, this, this._syncState);
                    this.trigger(STATE_CHANGE, this, this._syncState);
                }
            },
            beginSync: function() {
                var state;

                if ((state = this._syncState) === UNSYNCED || state === SYNCED) {
                    this._previousSync = this._syncState;
                    this._syncState    = SYNCING;

                    this.trigger(this._syncState, this, this._syncState);
                    this.trigger(STATE_CHANGE, this, this._syncState);
                }
            },
            finishSync: function() {
                if (this._syncState === SYNCING) {
                    this._previousSync = this._syncState;
                    this._syncState    = SYNCED;

                    this.trigger(this._syncState, this, this._syncState);
                    this.trigger(STATE_CHANGE, this, this._syncState);
                }
            },
            abortSync: function() {
                if (this._syncState === SYNCING) {
                    this._syncState    = this._previousSync;
                    this._previousSync = this._syncState;

                    this.trigger(this._syncState, this, this._syncState);
                    this.trigger(STATE_CHANGE, this, this._syncState);
                }
            }
        };

        var states = [UNSYNCED, SYNCING, SYNCED, STATE_CHANGE];

        handlerFn = function(event) {
            return SyncMachine[event] = function(callback, context) {
                if (context == null) {
                    context = this;
                }

                this.on(event, callback, context);

                if (this._syncState === event) {
                    return callback.call(context);
                }
            };
        };
        for (var i = 0, var len = states.length; i < len; i++) {
            event = states[i];
            handlerFn(event);
        }

        if (typeof Object.freeze === "function") {
            Object.freeze(SyncMachine);
        }

        module.exports = SyncMachine;

});<commit_msg>fix indentation<commit_after>/**
 * Adapted from ChaplinJS (http://chaplinjs.org/)
 */
define([
], function(
) {
    'use strict';

    var event, handlerFn;

    var UNSYNCED = 'unsynced',
        SYNCING = 'syncing',
        SYNCED = 'synced',
        STATE_CHANGE = 'syncStateChange';

    var SyncMachine = {

        _syncState         : UNSYNCED,
        _previousSyncState : null,

        syncState: function() {
            return this._syncState;
        },

        isUnsynced: function() {
            return this._syncState === UNSYNCED;
        },

        isSynced: function() {
            return this._syncState === SYNCED;
        },

        isSyncing: function() {
            return this._syncState === SYNCING;
        },

        unsync: function() {
            var state;

            if ((state = this._syncState) === SYNCING || state === SYNCED) {
                this._previousSync = this._syncState;
                this._syncState    = UNSYNCED;

                this.trigger(this._syncState, this, this._syncState);
                this.trigger(STATE_CHANGE, this, this._syncState);
            }
        },
        beginSync: function() {
            var state;

            if ((state = this._syncState) === UNSYNCED || state === SYNCED) {
                this._previousSync = this._syncState;
                this._syncState    = SYNCING;

                this.trigger(this._syncState, this, this._syncState);
                this.trigger(STATE_CHANGE, this, this._syncState);
            }
        },
        finishSync: function() {
            if (this._syncState === SYNCING) {
                this._previousSync = this._syncState;
                this._syncState    = SYNCED;

                this.trigger(this._syncState, this, this._syncState);
                this.trigger(STATE_CHANGE, this, this._syncState);
            }
        },
        abortSync: function() {
            if (this._syncState === SYNCING) {
                this._syncState    = this._previousSync;
                this._previousSync = this._syncState;

                this.trigger(this._syncState, this, this._syncState);
                this.trigger(STATE_CHANGE, this, this._syncState);
            }
        }
    };

    var states = [UNSYNCED, SYNCING, SYNCED, STATE_CHANGE];

    handlerFn = function(event) {
        return SyncMachine[event] = function(callback, context) {
            if (context == null) {
                context = this;
            }

            this.on(event, callback, context);

            if (this._syncState === event) {
                return callback.call(context);
            }
        };
    };

    for (var i = 0, len = states.length; i < len; i++) {
        event = states[i];
        handlerFn(event);
    }

    if (typeof Object.freeze === "function") {
        Object.freeze(SyncMachine);
    }

    return SyncMachine;
});
{'fraction_non_alphanumeric': 0.11227839789888379, 'fraction_numerical': 0.00032829940906106366, 'mean_word_length': 1.3997636864907443, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1661691', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1607, 'n_words': 322}