<commit_before>import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'

import ProductsList from '../components/ProductsList'
import { addProduct, deleteProduct } from '../redux/modules/products/actions'

class ProductsContainer extends Component {
    render() {

        const {products} = this.props;

        return (
            <ProductsList title="My Products">
                { products.map((product) => <p key={ product.id }>
                                                { product.id } &nbsp;-&nbsp;
                                                { product.description }
                                                <button onClick={ () => {
                                                                      this.props.deleteProduct(product.id)
                                                                  } }>
                                                    x
                                                </button>
                                            </p>) }
                <button onClick={ () => {
                                      let id = Math.floor(Math.random() * (100 - 5) + 5);
                                      this.props.addProduct({'id': id, 'description': 'product ' + id})
                                  } }>
                    ADD RANDOM PRODUCT
                </button>
            </ProductsList>

        )
    }
}

ProductsContainer.propTypes = {
    products: PropTypes.arrayOf(PropTypes.shape({
        id: PropTypes.number.isRequired,
        description: PropTypes.string.isRequired<commit_msg>refactor ProductsContainer<commit_after>import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'

import ProductsList from '../components/ProductsList'
import { addProduct, deleteProduct } from '../redux/modules/products/actions'

const doDeleteProduct = function(product) {
    this.props.deleteProduct(product.id)
}

const doAddProduct = function() {
    let id = Math.floor(Math.random() * (100 - 5) + 5);
    this.props.addProduct({'id': id, 'description': 'product ' + id})
}

class ProductsContainer extends Component {
    render() {

        const {products} = this.props;

        return (
            <ProductsList title="My Products">
                { products.map((product) => <p key={ product.id }>
                                                { product.id }
                                                <span>-</span>
                                                { product.description }
                                                <button onClick={ doDeleteProduct.bind(this, product) }>
                                                    x
                                                </button>
                                            </p>) }
                <button onClick={ doAddProduct.bind(this) }>
                    ADD RANDOM PRODUCT
                </button>
            </ProductsList>
        )
    }
}

ProductsContainer.propTypes = {
    products: PropTypes.arrayOf(PropTypes.shape({
        id: PropTypes.number.isRequired,
        description: PropTypes.string.isRequired
{'fraction_non_alphanumeric': 0.10243439772368006, 'fraction_numerical': 0.003161555485298767, 'mean_word_length': 1.1363943281566509, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 35, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5306970', 'n_tokens_mistral': 684, 'n_tokens_neox': 658, 'n_words': 147}