<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormInput } from 'react-form';
import Alert from 'react-bootstrap/lib/Alert';
import Col from 'react-bootstrap/lib/Col';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import Switch from 'react-bootstrap-switch';

import 'react-bootstrap-switch/dist/css/bootstrap3/react-bootstrap-switch.min.css';

class SwitchInput extends Component {
  static propTypes = {
    field: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.array,
    ]).isRequired,
    showErrors: PropTypes.bool.isRequired,
    errorBefore: PropTypes.bool.isRequired,
    isForm: PropTypes.bool.isRequired,
    noTouch: PropTypes.bool,
    getValue: PropTypes.func.isRequired,
    id: PropTypes.string.isRequired,
    label: PropTypes.node,
    help: PropTypes.node,
    warning: PropTypes.node,
  };

  static defaultProps = {
    showErrors: true,
    errorBefore: false,
    isForm: true,
  };

  constructor(props) {
    super(props);

    const { getValue } = this.props;
    this.state = { value: this.getBooleanValue(getValue(false)) };
  }

  getBooleanValue = value => parseInt(value, 10) ? true : false;

  render() {
    const {
      field,
      showErrors,
      errorBefore,
      isForm,
      noTouch,<commit_msg>[Client] Fix SwitchInput value<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormInput } from 'react-form';
import Alert from 'react-bootstrap/lib/Alert';
import Col from 'react-bootstrap/lib/Col';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import Switch from 'react-bootstrap-switch';

import 'react-bootstrap-switch/dist/css/bootstrap3/react-bootstrap-switch.min.css';

class SwitchInput extends Component {
  static propTypes = {
    field: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.array,
    ]).isRequired,
    showErrors: PropTypes.bool.isRequired,
    errorBefore: PropTypes.bool.isRequired,
    isForm: PropTypes.bool.isRequired,
    noTouch: PropTypes.bool,
    id: PropTypes.string.isRequired,
    label: PropTypes.node,
    help: PropTypes.node,
    warning: PropTypes.node,
  };

  static defaultProps = {
    showErrors: true,
    errorBefore: false,
    isForm: true,
  };

  constructor(props) {
    super(props);

    this.state = { value: false };
  }

  getBooleanValue = value => parseInt(value, 10) ? true : false;

  render() {
    const {
      field,
      showErrors,
      errorBefore,
      isForm,
      noTouch,
{'fraction_non_alphanumeric': 0.11603603603603603, 'fraction_numerical': 0.002162162162162162, 'mean_word_length': 3.6266666666666665, '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': '664526', 'n_tokens_mistral': 830, 'n_tokens_neox': 836, 'n_words': 191}