<commit_before>// @flow
import $ from './jquery.js'
import { COELEMENT_DATA_KEY_PREFIX, KEY_EVENT_LISTENERS } from './const.js'

/**
 * ClassComponentConfiguration is the utility class for class component initialization.
 * @param className The class name
 * @param Constructor The constructor of the coelement of the class component
 */
export default function createComponentInitializer (className: string, Constructor: Function) {
  const initClass = `${className}-initialized`

  /**
   * Initialize the html element by the configuration.
   * @param el The html element
   * @param coelem The dummy parameter, don't use
   */
  const initializer = (el: Object/* HTMLElement */, coelem: Constructor) => {
    const classList = el.classList

    if (!classList.contains(initClass)) {
      classList.add(initClass)
      el[COELEMENT_DATA_KEY_PREFIX + className] = coelem = new Constructor($(el))

      coelem.elem = coelem.$el = $(el)
      coelem.el = el

      if (typeof coelem.__init__ === 'function') {
        coelem.__init__()
      }

      (Constructor[KEY_EVENT_LISTENERS] || []).map(listenerBinder => {
        listenerBinder(el, coelem)
      })
    }
  }

  initializer.selector = `.${className}:not(.${initClass})`

  return initializer
}
<commit_msg>:art: doc(initializer): change flow annotation<commit_after>// @flow
import $ from './jquery.js'
import { COELEMENT_DATA_KEY_PREFIX, KEY_EVENT_LISTENERS } from './const.js'

/**
 * ClassComponentConfiguration is the utility class for class component initialization.
 * @param className The class name
 * @param Constructor The constructor of the coelement of the class component
 */
export default function createComponentInitializer (className: string, Constructor: Function) {
  const initClass = `${className}-initialized`

  /**
   * Initialize the html element by the configuration.
   * @param el The html element
   * @param coelem The dummy parameter, don't use
   */
  const initializer = (el: HTMLElement, coelem: Constructor) => {
    const classList = el.classList

    if (!classList.contains(initClass)) {
      classList.add(initClass)
      ;(el: any)[COELEMENT_DATA_KEY_PREFIX + className] = coelem = new Constructor($(el))

      coelem.elem = coelem.$el = $(el)
      coelem.el = el

      if (typeof coelem.__init__ === 'function') {
        coelem.__init__()
      }

      (Constructor[KEY_EVENT_LISTENERS] || []).map(listenerBinder => {
        listenerBinder(el, coelem)
      })
    }
  }

  initializer.selector = `.${className}:not(.${initClass})`

  return initializer
}

{'fraction_non_alphanumeric': 0.11950175165434021, 'fraction_numerical': 0.0, 'mean_word_length': 3.5729537366548043, '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': '1348233', 'n_tokens_mistral': 751, 'n_tokens_neox': 741, 'n_words': 206}