<commit_before>import Ember from 'ember'
const {
  Component,
  get,
  isEmpty,
  run,
  set,
  typeOf
} = Ember
import PropTypeMixin, {PropTypes} from 'ember-prop-types'
import layout from '../templates/components/frost-checkbox'

export default Component.extend(PropTypeMixin, {
  // == Properties ============================================================

  classNames: ['frost-checkbox'],
  classNameBindings: ['size'],
  layout,

  propTypes: {
    autofocus: PropTypes.bool,
    checked: PropTypes.bool,
    disabled: PropTypes.bool,
    hook: PropTypes.string,
    inputId: PropTypes.string,
    label: PropTypes.string,
    size: PropTypes.string
  },

  getDefaultProps () {
    return {
      autofocus: false,
      checked: false,
      disabled: false,
      inputId: null,
      label: '',
      size: 'small'
    }
  },

  // == Functions =============================================================

  /* Ember.Component method */
  didInsertElement () {
    if (get(this, 'autofocus')) {
      run.next('render', () => {
        this.$('input').focus()
      })
    }
  },
  init () {
    this._super(...arguments)
    this._setInputId()
  },

  keyPress (e) {
    if (e.keyCode === 32) {
      if (get(this, 'disabled') !== true) {
        this.$('input').prop('checked', !this.$('input').prop('checked'))
        this.send('input')
      }
      e.preventDefault()
      e.stopPropagation()
      return false
    }
  },

  // == Events ================================================================

  /**
   * Set unique inputId that will be set on label and input element
   * @private
   * @returns {undefined}
   */
  _setInputId () {
    if (!get(this, 'inputId')) {
      set(this, 'inputId', `${get(this, 'elementId')}_input`)
    }
  },
<commit_msg>Address PR comments<commit_after>import Ember from 'ember'
const {
  Component,
  get,
  isEmpty,
  run,
  set,
  typeOf
} = Ember
import PropTypeMixin, {PropTypes} from 'ember-prop-types'
import layout from '../templates/components/frost-checkbox'

export default Component.extend(PropTypeMixin, {
  // == Properties ============================================================

  classNames: ['frost-checkbox'],
  classNameBindings: ['size'],
  layout,

  propTypes: {
    autofocus: PropTypes.bool,
    checked: PropTypes.bool,
    disabled: PropTypes.bool,
    hook: PropTypes.string,
    inputId: PropTypes.string,
    label: PropTypes.string,
    size: PropTypes.string
  },

  getDefaultProps () {
    return {
      autofocus: false,
      checked: false,
      disabled: false,
      inputId: null,
      label: '',
      size: 'small'
    }
  },

  // == Functions =============================================================

  /* Ember.Component method */
  didInsertElement () {
    if (get(this, 'autofocus')) {
      run.next('render', () => {
        this.$('input').focus()
      })
    }
  },
  init () {
    this._super(...arguments)
    this._setInputId()
  },

  keyPress (e) {
    if (e.keyCode === 32) {
      if (get(this, 'disabled') !== true) {
        this.$('input').prop('checked', !this.$('input').prop('checked'))
        this.send('input')
      }
      e.preventDefault()
      e.stopPropagation()
      return false
    }
  },

  /**
   * Set unique inputId that will be set on label and input element
   * @private
   * @returns {undefined}
   */
  _setInputId () {
    if (!get(this, 'inputId')) {
      set(this, 'inputId', `${get(this, 'elementId')}_input`)
    }
  },

  // == Events ================================================================

{'fraction_non_alphanumeric': 0.24972004479283313, 'fraction_numerical': 0.0011198208286674132, 'mean_word_length': 2.904918032786885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5088744', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1068, 'n_words': 222}