<commit_before>import React from 'react';


export default React.createClass({

  propTypes: {
    items      : React.PropTypes.array, //{id, name, checked}
    name       : React.PropTypes.string,
    onChange   : React.PropTypes.func,
    orientation: React.PropTypes.string,
    value      : React.PropTypes.oneOfType([
      React.PropTypes.string,
      React.PropTypes.number,
      React.PropTypes.object
    ]),
  },

  getDefaultProps () {
    return {
      orientation: "horizontal",
      value      : null
    }
  },

  getInitialState () {
    let selectedItem;

    if (this.props.value)
      selectedItem = this.props.items.find(item => item.id == this.props.value) || this.props.items[0];
    else
      selectedItem = this.props.items.find(item => item.checked) || this.props.items[0];

    return {
      selectedItem: selectedItem
    }
  },

  onChange (item) {
    if (!this.props.onChange) return;

    this.props.onChange(item);
  },

  getValue () {
    return this.state.selectedItem.id
  },

  onClick (item) {
    this.setState({
      selectedItem: item
    });

    this.onChange(item);
  },

  render () {
    return (
      <div className={`radio-component ${this.props.orientation}`}>
        {
          this.props.items.map((item, index) => {
            let opts = { name: this.props.name };
            if(item.id === this.state.selectedItem.id) {
              opts.checked = true;
            }

            return (
              <div key={index} className="radio-custom radio-primary" onClick={this.onClick.bind(this, item)}>
                <input type="radio" {...opts} onChange={() => {}} />
                <label>{item.text}</label>
              </div>
            )
          })
        }
      </div>
    );
  }

});<commit_msg>Indent code<commit_after>import React from 'react';


export default React.createClass({

  propTypes: {
    items      : React.PropTypes.array, //{id, name, checked}
    name       : React.PropTypes.string,
    onChange   : React.PropTypes.func,
    orientation: React.PropTypes.string,
    value      : React.PropTypes.oneOfType([
      React.PropTypes.string,
      React.PropTypes.number,
      React.PropTypes.object
    ]),
  },

  getDefaultProps () {
    return {
      orientation: "horizontal",
      value      : null
    }
  },

  getInitialState () {
    let selectedItem;

    if (this.props.value)
      selectedItem = this.props.items.find(item => item.id == this.props.value) || this.props.items[0];
    else
      selectedItem = this.props.items.find(item => item.checked) || this.props.items[0];

    return {
      selectedItem: selectedItem
    }
  },

  onChange (item) {
    if (!this.props.onChange) return;

    this.props.onChange(item);
  },

  getValue () {
    return this.state.selectedItem.id
  },

  onClick (item) {
    this.setState({
      selectedItem: item
    });

    this.onChange(item);
  },

  render () {
    return (
      <div className={`radio-component ${this.props.orientation}`}>
        {
          this.props.items.map((item, index) => {
            let opts = { name: this.props.name };
            if (item.id === this.state.selectedItem.id) {
              opts.checked = true;
            }

            return (
              <div key={index} className="radio-custom radio-primary" onClick={this.onClick.bind(this, item)}>
                <input type="radio" {...opts} onChange={() => {}} />
                <label>{item.text}</label>
              </div>
            )
          })
        }
      </div>
    );
  }

});
{'fraction_non_alphanumeric': 0.14852320675105485, 'fraction_numerical': 0.0011251758087201125, 'mean_word_length': 1.9461474730737365, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '4797646', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1088, 'n_words': 186}