<commit_before>import React from 'react';
import StyleHandler from './style-handler';

export default function componentWrapper(EL, styles, number) {

  const className = `${EL}-${number}`;
  const styleHandler = new StyleHandler(className, styles);
  let totalCounter = 0;

  class StyledElement extends React.PureComponent {
    componentWillMount() {
      this.swissId = `${className}-${++totalCounter}`;
      this.iterateHandlers(handler => handler.subscribe(this.swissId, this.props));
    }
    componentWillUnmount() {
      this.iterateHandlers(handler => handler.unsubscribe(this.swissId, this.props));
    }
    componentWillReceiveProps(nextProps) {
      this.iterateHandlers(handler => handler.update(this.swissId, nextProps, this.props));
    }
    iterateHandlers(iterator) {
      let { expand } = this.props;
      iterator(styleHandler);
      if(expand) {
        if(!Array.isArray(expand)) {
          expand = [ expand ];
        }
        expand.forEach((exClass) => {
          if(typeof exClass === 'function' && typeof exClass._getStyleHandler === 'function') {
            iterator(exClass._getStyleHandler());
          }
        })
      }
    }
    render() {
      let computedClassName = `${this.swissId}`;

      const allHandledProps = new Set(['className', 'swiss', 'expand']);

      this.iterateHandlers((handler) => {
        const dClassName = handler.getClassName();
        computedClassName += ` ${dClassName}`;

        const handledProps = handler.getHandledProps();
        Object.entries(this.props).forEach(([propName, propValue]) => {
          if(handledProps.keys[propName]) {
            computedClassName += ` ${dClassName}-${propName}`;
          }
          if(handledProps.values[propName]) {
            computedClassName += ` ${dClassName}-${propName}-${propValue}`;
          }
          if(handledProps.all.indexOf(propName) > -1) {<commit_msg>fixed bug with props always being added to class<commit_after>import React from 'react';
import StyleHandler from './style-handler';

export default function componentWrapper(EL, styles, number) {

  const className = `${EL}-${number}`;
  const styleHandler = new StyleHandler(className, styles);
  let totalCounter = 0;

  class StyledElement extends React.PureComponent {
    componentWillMount() {
      this.swissId = `${className}-${++totalCounter}`;
      this.iterateHandlers(handler => handler.subscribe(this.swissId, this.props));
    }
    componentWillUnmount() {
      this.iterateHandlers(handler => handler.unsubscribe(this.swissId, this.props));
    }
    componentWillReceiveProps(nextProps) {
      this.iterateHandlers(handler => handler.update(this.swissId, nextProps, this.props));
    }
    iterateHandlers(iterator) {
      let { expand } = this.props;
      iterator(styleHandler);
      if(expand) {
        if(!Array.isArray(expand)) {
          expand = [ expand ];
        }
        expand.forEach((exClass) => {
          if(typeof exClass === 'function' && typeof exClass._getStyleHandler === 'function') {
            iterator(exClass._getStyleHandler());
          }
        })
      }
    }
    render() {
      let computedClassName = `${this.swissId}`;

      const allHandledProps = new Set(['className', 'swiss', 'expand']);

      this.iterateHandlers((handler) => {
        const dClassName = handler.getClassName();
        computedClassName += ` ${dClassName}`;

        const handledProps = handler.getHandledProps();
        Object.entries(this.props).forEach(([propName, propValue]) => {
          if(handledProps.keys[propName] && this.props[propName]) {
            computedClassName += ` ${dClassName}-${propName}`;
          }
          if(handledProps.values[propName]) {
            computedClassName += ` ${dClassName}-${propName}-${propValue}`;
          }
          if(handledProps.all.indexOf(propName) > -1) {
{'fraction_non_alphanumeric': 0.143522110162917, 'fraction_numerical': 0.001034393586759762, 'mean_word_length': 2.9794238683127574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5183475', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1090, 'n_words': 189}