<commit_before>// auto-suggest docs:
// http://code.drewwilson.com/entry/autosuggest-jquery-plugin
// Changes to previous
// - prefill and ashtmlid in data-auto-suggest-config
define([
    'jquery',
    '../logging',
    '../core/parser',
    '../registry',
    '../utils',
    'jquery_autosuggest'
], function($, logging, Parser, registry, utils) {
    var log = logging.getLogger('autosuggest');

    var parser = new Parser("autosuggest");
    parser.add_argument('words');
    parser.add_argument('prefill');
    parser.add_argument('as-html-id', false);
    parser.add_argument('selected-value-prop', "name");
    parser.add_argument('search-obj-prop', "name");
    parser.add_argument('start-text', "Enter text");

    var _ = {
        name: 'autosuggest',
        trigger: "input.pat-autosuggest",
        init: function($el, opts) {
            if ($el.length > 1) {
                return $el.map(function() {
                    return _.init($(this), opts);
                });
            }

            // fetch config from first parent found
            cfg = _.parser.parse($el, opts);
            if ($el.attr('readonly')) {
                cfg.startText = "";
            }

            if (cfg.prefill && (cfg.prefill.slice(0,1) === ',')) {
                cfg.prefill = cfg.prefill.slice(1);
            }

            $el.data("patterns.autosuggest", cfg);

            $el.on('keydown.pat-autosuggest', _.onKeyDown);

            // are we autosubmit?
            var autosubmit = $el.is('.pat-autosubmit') ||
                    ($el.parents('.pat-autosubmit').length > 0);
            log.debug('autosubmit', autosubmit, $el);

            var $form;
            if (autosubmit) {
                $form = $el.parents('form');
                var submit_debounced = utils.debounce(function() {
                    $form.submit();
                }, 400);<commit_msg>declare variable<commit_after>// auto-suggest docs:
// http://code.drewwilson.com/entry/autosuggest-jquery-plugin
// Changes to previous
// - prefill and ashtmlid in data-auto-suggest-config
define([
    'jquery',
    '../logging',
    '../core/parser',
    '../registry',
    '../utils',
    'jquery_autosuggest'
], function($, logging, Parser, registry, utils) {
    var log = logging.getLogger('autosuggest');

    var parser = new Parser("autosuggest");
    parser.add_argument('words');
    parser.add_argument('prefill');
    parser.add_argument('as-html-id', false);
    parser.add_argument('selected-value-prop', "name");
    parser.add_argument('search-obj-prop', "name");
    parser.add_argument('start-text', "Enter text");

    var _ = {
        name: 'autosuggest',
        trigger: "input.pat-autosuggest",
        init: function($el, opts) {
            if ($el.length > 1) {
                return $el.map(function() {
                    return _.init($(this), opts);
                });
            }

            // fetch config from first parent found
            var cfg = _.parser.parse($el, opts);
            if ($el.attr('readonly')) {
                cfg.startText = "";
            }

            if (cfg.prefill && (cfg.prefill.slice(0,1) === ',')) {
                cfg.prefill = cfg.prefill.slice(1);
            }

            $el.data("patterns.autosuggest", cfg);

            $el.on('keydown.pat-autosuggest', _.onKeyDown);

            // are we autosubmit?
            var autosubmit = $el.is('.pat-autosubmit') ||
                    ($el.parents('.pat-autosubmit').length > 0);
            log.debug('autosubmit', autosubmit, $el);

            var $form;
            if (autosubmit) {
                $form = $el.parents('form');
                var submit_debounced = utils.debounce(function() {
                    $form.submit();
                }, 400);
{'fraction_non_alphanumeric': 0.1653896961690885, 'fraction_numerical': 0.004227212681638045, 'mean_word_length': 1.8359550561797753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '636643', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1124, 'n_words': 203}