<commit_before>import React, { Component } from 'react';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';

import {
    objectOf,
    any,
    string,
    bool,
    func,
    arrayOf,
    shape,
    number
  } from 'prop-types';

import withMuiThemeProvider from 'helpers/withMuiThemeProvider';

import styles from './styles.scss';

@withMuiThemeProvider
export default class FileUploader extends Component {
    static propTypes = {
        acceptedFileTypes: arrayOf(string),
        onFilesSelected: func
    }

    state = {
        files: [],
        acceptedFileTypes: this.props.acceptedFileTypes || []
    }

    handleFileSelection = event => {
        this.setState({files: event.target.files});
        let target = event.target || event.srcElement;
        if (target.files.length > 0) {
            this.props.onFilesSelected(Array.from(target.files));
        }

        this.fileInput.value = null;
    }

    render () {
        return (
            <div className={styles.fileUploader}>
                <span className={styles.fileUploadIcon}>
                    <i className="icon-cloud_upload"></i>
                </span>
                <span className={styles.fileUploaderSubtext}>
                    Drag & Drop file(s) to upload or
                </span>
                <input accept={this.state.acceptedFileTypes.join(',')} 
                       id="file" 
                       multiple 
                       type="file"
                       ref={ele => this.fileInput = ele}
                       onChange={this.handleFileSelection}/>
                <label htmlFor="file">
                    <Button raised color="primary" component="span">
                        Choose File
                    </Button>
                </label>
            </div>
        );
    }
}<commit_msg>ES6 oops.<commit_after>import React, { Component } from 'react';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';

import {
    string,
    func,
    arrayOf,
    oneOfType
  } from 'prop-types';

import withMuiThemeProvider from 'helpers/withMuiThemeProvider';

import styles from './styles.scss';

@withMuiThemeProvider
export default class FileUploader extends Component {
    static propTypes = {
        acceptedFileTypes: oneOfType([arrayOf(string), string]),
        onFilesSelected: func
    }

    state = {
        files: [],
        acceptedFileTypes: this.props.acceptedFileTypes || []
    }

    handleFileSelection = event => {
        this.setState({files: event.target.files});
        let target = event.target || event.srcElement;
        if (target.files.length > 0) {
            this.props.onFilesSelected(Array.from(target.files));
        }

        this.fileInput.value = null;
    }

    render () {
        let accept = typeof this.state.acceptedFileTypes === 'string' ?
            this.state.acceptedFileTypes :
            this.state.acceptedFileTypes.join(',');
        return (
            <div className={styles.fileUploader}>
                <span className={styles.fileUploadIcon}>
                    <i className="icon-cloud_upload"></i>
                </span>
                <span className={styles.fileUploaderSubtext}>
                    Drag & Drop file(s) to upload or
                </span>
                <input accept={accept} 
                       id="file" 
                       multiple 
                       type="file"
                       ref={ele => this.fileInput = ele}
                       onChange={this.handleFileSelection}/>
                <label htmlFor="file">
                    <Button raised color="primary" component="span">
                        Choose File
                    </Button>
                </label>
            </div>
        );
    }
}
{'fraction_non_alphanumeric': 0.10972113630440448, 'fraction_numerical': 0.0007818608287724785, 'mean_word_length': 1.6634281748785567, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, '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': '1465341', 'n_tokens_mistral': 1014, 'n_tokens_neox': 971, 'n_words': 207}