<commit_before>import React, { PropTypes } from 'react'
import Dropzone from 'react-dropzone'
import { connect } from 'react-redux'
import * as UploadActions from 'shared/actions/UploadActions'

@connect(state => ({
  upload: state.upload
}))
export default class ImageUpload extends React.Component {

  static propTypes = {
    index: PropTypes.number.isRequired,
    upload: PropTypes.object.isRequired,
    src: PropTypes.string.isRequired,
    dispatch: PropTypes.func.isRequired
  }

  static defaultProps = {
    index: 0,
    src: '/images/image.png'
  }

  constructor (props) {
    super(props)
  }

  handleDrop (files) {
    const sizeLimit = 1024 * 1024 * 3
    const { dispatch } = this.props
    const file = files[0]
    if (file.size > sizeLimit) {
      dispatch(UploadActions.setErrorMessage('1', 'too large'))
      return
    }

    if (typeof file.preview !== 'undefined') {
      dispatch(UploadActions.clearErrorMessage())
      dispatch(UploadActions.send(file.name, file, this.props.index))
      this.forceUpdate()
    }
  }

  renderPrecentage () {
    const percentage = this.props.upload.percentages[this.props.index]
    if (!this.props.upload.errors && percentage) {
      return (<span>{percentage} %</span>)
    } else {
      return (<span></span>)
    }
  }

  render () {
    let img
    if (typeof this.props.upload.images !== 'undefined') {
      img = this.props.upload.images[this.props.index]
    }

    if (this.props.upload.errorId) {
      setTimeout(() => {
        this.props.dispatch(UploadActions.clearErrorMessage())
      }, 3000)
    }
    return (
      <Dropzone
        multiple={false}
        style={{}}
        size={120}
        className="column"
        onDrop={::this.handleDrop}>
        <img
          className="ui image centered"
          alt=""
          src={ img || this.props.src } />
        {::this.renderPrecentage()}
      </Dropzone>
    )
  }
}<commit_msg>don't clear upload error message<commit_after>import React, { PropTypes } from 'react'
import Dropzone from 'react-dropzone'
import { connect } from 'react-redux'
import * as UploadActions from 'shared/actions/UploadActions'

@connect(state => ({
  upload: state.upload
}))
export default class ImageUpload extends React.Component {

  static propTypes = {
    index: PropTypes.number.isRequired,
    upload: PropTypes.object.isRequired,
    src: PropTypes.string.isRequired,
    dispatch: PropTypes.func.isRequired
  }

  static defaultProps = {
    index: 0,
    src: '/images/image.png'
  }

  constructor (props) {
    super(props)
  }

  handleDrop (files) {
    const sizeLimit = 1024 * 1024 * 3
    const { dispatch } = this.props
    const file = files[0]
    if (file.size > sizeLimit) {
      dispatch(UploadActions.setErrorMessage('1', 'too large'))
      return
    }

    if (typeof file.preview !== 'undefined') {
      dispatch(UploadActions.clearErrorMessage())
      dispatch(UploadActions.send(file.name, file, this.props.index))
      this.forceUpdate()
    }
  }

  renderPrecentage () {
    const percentage = this.props.upload.percentages[this.props.index]
    if (!this.props.upload.errors && percentage) {
      return (<span>{percentage} %</span>)
    } else {
      return (<span></span>)
    }
  }

  render () {
    let img
    if (typeof this.props.upload.images !== 'undefined') {
      img = this.props.upload.images[this.props.index]
    }

    return (
      <Dropzone
        multiple={false}
        style={{}}
        size={120}
        className="column"
        onDrop={::this.handleDrop}>
        <img
          className="ui image centered"
          alt=""
          src={ img || this.props.src } />
        {::this.renderPrecentage()}
      </Dropzone>
    )
  }
}
{'fraction_non_alphanumeric': 0.13640010698047605, 'fraction_numerical': 0.009093340465365071, 'mean_word_length': 2.627546071774976, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 22, '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': '4882041', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1124, 'n_words': 237}