<commit_before>import React, { PropTypes } from 'react';
import cssClasses from './../cssClasses';
import classNames from 'classnames';

const propTypes = {
    label: PropTypes.string.isRequired,
    icon: PropTypes.string,
    disabled: PropTypes.bool,
    onClick: PropTypes.func,
    data: PropTypes.any,
    target: PropTypes.any
};

const defaultProps = {
    disabled: false
};

class Item extends React.Component {

    constructor(props) {
        super(props);
        this.bindEvent();
    }

    bindEvent() {
        if (this.props.disabled !== true) {
            if (typeof this.props.onClick === 'function') {
                this.handleClick = () => this.props.onClick(this, this.props.target);
            } else {
                // Maybe it's unnecessary to warn
                this.handleClick = () => console.warn(`Did you forget to bind an event
                on the "${this.props.label}" item ? `);
            }
        } else {
            this.handleClick = (e) => e.stopPropagation();
        }
    }

    buildItem() {
        return (
            <div className={cssClasses.ITEM_DATA}>
                {this.hasIcon()}
                {this.props.label}
            </div>
        );
    }

    hasIcon() {
        return this.props.icon
            ? <span className={`${cssClasses.ITEM_ICON} ${this.props.icon}`}></span>
            : '';
    }

    render() {
        const className = classNames(cssClasses.ITEM, {
            [`${cssClasses.ITEM_DISABLED}`]: this.props.disabled
        });
        return (
            <div className={className} onClick={this.handleClick}>
                {this.buildItem()}
            </div>
        );
    }
}

Item.propTypes = propTypes;
Item.defaultProps = defaultProps;

export default Item;
<commit_msg>Removed unecessary check, rely on proptypes instead<commit_after>import React, { Component, PropTypes } from 'react';
import cssClasses from './../cssClasses';
import classNames from 'classnames';

const propTypes = {
    label: PropTypes.string.isRequired,
    icon: PropTypes.string,
    disabled: PropTypes.bool,
    onClick: PropTypes.func,
    data: PropTypes.any,
    target: PropTypes.any
};

const defaultProps = {
    disabled: false,
    onClick: null
};

class Item extends React.Component {

    constructor(props) {
        super(props);
        this.bindEvent();
    }

    bindEvent() {
        if (this.props.disabled !== true) {
            if (null !== this.props.onClick) {
                this.handleClick = () => this.props.onClick(this, this.props.target);
            } else {
                // Maybe it's unnecessary to warn
                this.handleClick = () => console.warn(`Did you forget to bind an event
                on the "${this.props.label}" item ? `);
            }
        } else {
            this.handleClick = (e) => e.stopPropagation();
        }
    }

    buildItem() {
        return (
            <div className={cssClasses.ITEM_DATA}>
                {this.hasIcon()}
                {this.props.label}
            </div>
        );
    }

    hasIcon() {
        return this.props.icon
            ? <span className={`${cssClasses.ITEM_ICON} ${this.props.icon}`}></span>
            : '';
    }

    render() {
        const className = classNames(cssClasses.ITEM, {
            [`${cssClasses.ITEM_DISABLED}`]: this.props.disabled
        });
        return (
            <div className={className} onClick={this.handleClick}>
                {this.buildItem()}
            </div>
        );
    }
}

Item.propTypes = propTypes;
Item.defaultProps = defaultProps;

export default Item;

{'fraction_non_alphanumeric': 0.1336647334990334, 'fraction_numerical': 0.0, 'mean_word_length': 1.8677751385589865, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '7519113', 'n_tokens_mistral': 1019, 'n_tokens_neox': 1024, 'n_words': 214}