<commit_before>import React from 'react/addons';





let Suggestion = React.createClass({

    render() {
        console.info('Suggestion.render', this.props.suggestion);
        var suggestion = this.props.suggestion;
        let classes = ['Suggestion'];
        if (this.props.selected) {
            classes.push('selected');
        }
        return (
            <div className={classes.join(' ')} data-suggestion={suggestion}>
                {suggestion}
            </div>
        );
    }
});


let DropDown = React.createClass({

    handleClick(event) {
        //console.info('DropDown.handleClick');
        let suggestion = event.target.getAttribute('data-suggestion');
        this.props.handleClick(suggestion);
    },

    render() {
        //console.info('DropDown.render', this.props.suggestions);
        let index = this.props.index;
        let suggestions = this.props.suggestions;
        let renderer = this.props.renderer;

        //console.info('renderer', renderer);

        let entries = [];

        if (suggestions && suggestions.length > 0) {

            entries = suggestions
                .map((suggestion, i) => {
                    let classes = ['Suggestion'];
                    let selected = (i === index);
                    if (selected) {
                        classes.push('selected');
                    }

                    if (renderer) {
                        //value = renderer
                        return React.addons.cloneWithProps(renderer, {
                            className: classes.join(' '),
                            suggestion: suggestion,
                            key: i,
                            onClick: this.handleClick
                        });
                    } else {
                        /*return (
                            <div onClick={this.handleClick}
                                 data-suggestion={suggestion}
                                 selected={selected}
                                 key={suggestion + i}>
                                {suggestion}
                            </div>
                        );*/
                        return <Suggestion suggestion={suggestion} selected={selected} />
                    }

                });
        }
        let styles = {
            display: this.props.display ? 'block' : 'none'
        };

        return <div className="DropDown" style={styles}>{entries}</div>;
    }
});


export default DropDown;<commit_msg>add key<commit_after>import React from 'react/addons';





let Suggestion = React.createClass({

    render() {
        console.info('Suggestion.render', this.props.suggestion);
        var suggestion = this.props.suggestion;
        let classes = ['Suggestion'];
        if (this.props.selected) {
            classes.push('selected');
        }
        return (
            <div className={classes.join(' ')} data-suggestion={suggestion}>
                {suggestion}
            </div>
        );
    }
});


let DropDown = React.createClass({

    handleClick(event) {
        //console.info('DropDown.handleClick');
        let suggestion = event.target.getAttribute('data-suggestion');
        this.props.handleClick(suggestion);
    },

    render() {
        //console.info('DropDown.render', this.props.suggestions);
        let index = this.props.index;
        let suggestions = this.props.suggestions;
        let renderer = this.props.renderer;

        //console.info('renderer', renderer);

        let entries = [];

        if (suggestions && suggestions.length > 0) {

            entries = suggestions
                .map((suggestion, i) => {
                    let classes = ['Suggestion'];
                    let selected = (i === index);
                    if (selected) {
                        classes.push('selected');
                    }

                    if (renderer) {
                        //value = renderer
                        return React.addons.cloneWithProps(renderer, {
                            className: classes.join(' '),
                            suggestion: suggestion,
                            key: i,
                            onClick: this.handleClick
                        });
                    } else {
                        /*return (
                            <div onClick={this.handleClick}
                                 data-suggestion={suggestion}
                                 selected={selected}
                                 key={suggestion + i}>
                                {suggestion}
                            </div>
                        );*/
                        return <Suggestion key={i} suggestion={suggestion} selected={selected} />
                    }

                });
        }
        let styles = {
            display: this.props.display ? 'block' : 'none'
        };

        return <div className="DropDown" style={styles}>{entries}</div>;
    }
});


export default DropDown;
{'fraction_non_alphanumeric': 0.11507778220981252, 'fraction_numerical': 0.00039888312724371757, 'mean_word_length': 1.1890004364906155, 'pattern_counts': {'":': 0, '<': 17, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7271330', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1140, 'n_words': 219}